modx getResources tv - modx

I have a page for a sports club based on ModXCMS 2.1.4.
For a list of sport classes I have appr. 30 Documents for the different.
Each of this has template variables like abteilung, Wochentag, Startzeit, etc.
The tv.Wochentag contains Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag,Sonntag as weekdays.
Now my problem:
The output is not sorted by the variable.
Here my code:
[[getResources?
&parents=`19`
&debug=`1`
&tvFilters=`abteilung==[[*abteilung]]`
&sortby=`{tv.Wochentag:"Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag,Sonntag":"ASC",tv.UhrzeitStart:"ASC"}`
&tpl=`snipSportangebot`
&includeTVs=`1`
&tvPrefix=``
&limit=`0`
&processTVs=`1`]]
Finaly I would like to sort by Wochentag (Weekday) and StartZeit (Starttime/Time).
What have I done wrong?
Has anyone any hint on this.
Thanks in advance
Christian

Join weekday and starttime to one TV - Input Type: Date, then you will be able to sorting by TV in getResources:
sortbyTV - Template Variable to sort by
sortdirTV - Order which to sort by when using sortbyTV
sortbyTVType - Specify the data type of the sortby TV. Possible values are string, integer, decimal, datetime
https://rtfm.modx.com/extras/revo/getresources

Youy cannot sort by a TV using sortby [see the docs] if you try to use sortbyTV & sortdirTV it's going to sort them alphabetically for you.
set your day of the week tvs values to numeric :
Montag==0||Dienstag==1||Mittwoch==2||Donnerstag... etc
then your sortbyTV & sortdirTV should behave as expected

Related

Create a text cell value based on row entries and corresponding columns

I understand this is a tough way of wording the problem I have. Please try and help me.
I want to create a Column called Orders which contains cells based on corresponding item values.
So if I have columns: FlatNo, Truffle, Pineapple, Mango, Chocochips; I want to create a column called Orders which has value:
FlatNo - A51
Mango - 1
Chocochips - 1
(if no values in the Pineapple & Truffle Columns, none show up in Orders columns)
See image
How do I do that ? Thank you in advance
You can use IF and &. & simply puts the different desired things altogether.
Hope the following formula will get you the result for column orders. I have put the number of each item ordered inside parentheses before the item.
="Flat No. "&A2&IF(ISBLANK(B2),"","-("&B2&")"&$B$1)&IF(ISBLANK(C2),"","-("&C2&")"&$C$1)&IF(ISBLANK(D2),"","-("&D2&")"&$D$1)&IF(ISBLANK(E2),"","-("&E2&")"&$E$1)
For instance the third order is shown like this: Flat No. E-23-(1)Truffle -1 Pc Rs 60-(3)Mango -1 Pc Rs 60

Acumatica. How to create parameters based on a given date

I have a report that use a cutoff date, based on this date I have to read records from 3 months ago, is there any way I can create parameters to use base on this date?
for instance I was considering to create period parameters from given date as 07/13/2018:
begperiod = 05-2018
endperiod = 07-2018.
Any idea? is there any other way to use this fields on the filters as parameters?
Your best bet would be to adjust the date in your Filters on the line sending the date to be compared to SQL. You'd want to put in the Value1 column something like this:
=DateAdd( #Date, 'm', -3)
What that does is it takes your date parameter and subtracts 3 months from it. The entire line should look something like this:
DACTableName.DateFieldName GreaterOrEqual =DateAdd( #StartDate, 'm', -3)

Excel Using concatenate to compare dates

I have a table containing several columns of which one is a date/time field. I am trying to get a count of instances per day using the following
=COUNTIFS(Table4[Data],"Apple",Table4[Date],(CONCATENATE(V4,"*")))
Data Date Comp Date Count
Apple 6/12/18 1:00 PM 6/12/18 12:00 AM 0
Apple 6/12/18 7:00 AM
Orange 6/12/18 1:30 PM
Apple 6/11/18 11:23 AM
From my understanding of all the moving parts here I should be checking to see if "Apple" exists in the data column and then if "6/12/18" with any amount or type of characters after it exists. If both are true I will then get a count + 1 leaving me with a value of 2 in the above example.
What I actually get however is a 0 unless I match the time portion of date the data to be exactly the same and then removed the wildcard ,"*" from the equation.
Am I doing something wrong or can the wildcard not be used to accomplish what I am trying?
Thanks!
I think you should set your criteria properly.
If you add an additional column next to your Date that contains calculates the integer value of your date using INT() and format the display as DATE (m/d/yyyy) you should then be able to use the following COUNTIFS formula
=COUNTIFS(Table4[Data], "Apple", Table4[Date], "=6/12/18")
See the explanatory video from their Office' support site: https://support.office.com/en-us/article/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842
If your [Date] column is a datetime or smalldatetime, you can work with it using CONVERT function, depending on how you want to group.
For example, if you don't care about the time to do the group, you could use the next query:
SELECT CONVERT(varchar,[Date],103), [Data], COUNT(*)
FROM [test_delete].[dbo].[Table1]
GROUP BY CONVERT(varchar,[Date],103), [Data]
This should result in something like this:
[Date] [Data] [Count]
11/06/2018 Apple 1
12/06/2018 Apple 2
12/06/2018 Orange 1
Hope this helps you
If your dates are stored as dates instead of text, use the following:
=COUNTIFS(Table4[Data],"Apple",Table4[Date],">="&V4,Table4[Date],"<"&V4+1)

oracle date to string

I have this problem: I want to convert the sysdate to string, using fillmode on month, day and hour only. However,
select to_char(sysdate, 'fmmm/fmdd/yyyy fmhh12:mi:ss am') from dual
gives me results like
11/13/2013 9:45:**0** am
although it should be
11/13/2013 9:45:**00** am
any thoughts? Thanks in advance
You shouldn't use the FM format model, because FM, as written in the documentation:
FM - Used in combination with other elements to direct the suppression of leading or trailing blanks
So using FM will make your final string shorter, if possible.
You should remove the FM from your format model mask and it will work as you expect:
select to_char(TRUNC(sysdate), 'mm/dd/yyyy hh12:mi:ss am') from dual;
Output:
11/13/2013 12:00:00 am.
I've changed my answer after reading Nicholas Krasnov's comment (thanks).
More about date format models in Oracle Documentation: Format models
Edit
Yes, the code I provided would return, for example, 01-01-2013. If you want to have the month and day without leading zeroes, than you should write it like this: fmDD-MM-YYYY fmHH:MI:SS.
The first fm makes the leading zeroes be truncated. The second fm turns off that feature and you do get leading zeroes for the time part of the date, example:
SELECT TO_CHAR(
TO_DATE('01-01-2013 10:00:00', 'DD-MM-YYYY HH12:MI:SS'),
'fmmm/dd/yyyy fmhh12:mi:ss am')
FROM dual;
Output:
1/1/2013 10:00:00 am.

Sharepoint CAML Date query

im getting different results based on the date i use to search on.
Here are the 3 records i want to display, their values for EVENTDATE, and ENDDATE are as follows
1, 2009-08-11T00:00:00Z, 2009-08-14T23:59:59Z
2, 2009-08-11T00:00:00Z, 2009-08-14T23:59:59Z
3, 2009-08-14T20:00:00Z, 2009-08-14T22:00:00Z
When i search for a time between EventDate and EndDate
- 2009-08-14T20:00:00Z, 2009-08-14T22:00:00Z
= i get rows 1,2
- 2009-08-14 T20:00:00Z, 2009-08-14 T22:00:00Z
= i get rows 3
Why does adding a space between the date and time give me a diff result? The entries into the list are the same, the return results dates are the exact same format.
Although the ISO 8601 standard specifies that a space to either side of the T is valid, I would guess that the CAML parser only accepts non spaces. And what you are seeing is a side effect.

Resources