This topic has been moved from a previous topic
Thanks Elton.
I removed the form name from the CSS items, and here is what happened:

image2114×848 196 KB
It still shows the date correctly, but now I have “undefined/undefined/” before the dates and check numbers. Does the CSS assume a form name? It worked fine when the form name was also part of the CSS. Thanks…
Hi Ron,
It should not alter the report. Could you please share a new version of your application, so I can better investigate it?
Thank you
Elton S
thanks Elton. You are correct, it should not alter the report.
The good news: even without the form name in the CSS, in the dataview it properly displays that text in the expected manner.
There is obviously something else that seeped into the report definition. I have updated the newest FDF to the OneDrive folder. You can see it if you open the Generate Reports menu item, choose the StudyGroupRoster and run it.
Hi Ron,
The issue is not related to the CSS, the issue is caused by the function IsSGFeePastDue.
In the image, you can see that invalid data is returned.
My suggestion is to debug this function so you can better understand the error.

image1757×946 109 KB
Regards,
Elton S
Thanks Elton,
I don’t have the knowledge of debugging tools that you do, so I’m limited to inserting log statements in the code and using the inspector.
What I did learn:
-
ValidTo and Paid use the USDate function in template to display in m/d/yyyy format
-
Both fields in CSS are colored blue if older than they should be
-
{{USDate Paid}} is causing the d/m/yyyy converted date to be sent to IsSGFeePastDue function instead of the yyyy-mm-dd actual field value per logging
#3 is what is causing the issue, since the function expects yyyy-mm-dd format. I don’t understand this, because the code has always worked before.
This same issue doesn’t happen with the ValidTo date field. Per the logging, the IsDuesPastDue function is in yyyy-mm-dd format.
Why does the “real” yyyy-mm-dd date value show up in the IsDuesPastDue function, but the m/d/yyyy date value show up in the IsSGFeePastDue function?
If I remove USDate from {{USDate ValidTo}}, the report still renders ValidTo as m/d/yyyy, but if I remove USDate from {{USDate Paid}}, the report renders the date as yyyy-mm-dd. Why do these act different?
Is there an alternative to using the USDate function in the template? In form design, you can choose a display format. Is this possible with a report template?
Hi Ron,
I made a mistake on my previous assumption; the function causing the issue is ‘USDate’. It is because the function expects data in the format of ‘yyyy-mm-dd’, which is correct for the field ‘ValidTo’; however, when calling this function for the field Paid (m/d/yyyy), the function returns undefined due to the incompatibility in the format.
The fields ValidTo (yyyy-mm-dd) and Paid (m/d/yyyy) have different formats; the query rqStudyGroupRoster used in the report displays them accordingly. Therefore, you can either create a different function to treat different data formats (recommended) or change your current function to treat both cases.
You can search for any tutorial available to debug JavaScript in the browser, as it is not a five-step feature.
What I can suggest is that the easiest way to debug is to add the command ‘debugger’ before the code you want to start monitoring (for debugging).
Open the inspect mode in your browser and run the report. The code will stop, and you can step into each command.
Regards
Elton S
I’m very confused by this answer.
If I query the data directly, both the ValidTo and Paid columns in all records is a typical date, in the format yyyy-mm-dd. I queried them by running the rqStudyGroupRoster query directly (I needed to comment/uncomment 2 lines to ignore parameters).
I then changed the template for the roster and removed the USDate function from both places ({{USDate ValidTo}} and {{USDate Paid}}), and ran the report. Now the report looks like this:
In the IsSGFeePastDue function, the logged date is in m/d/yyyy format per inspector, just like in the picture above. this is strange since I removed the USDate function from the field name in the template. I expect that both dates should be in yyyy-mm-dd format. Any ideas why this is happening? At least I’m not getting the “undefined” messages.
Hi Ron,
In my previous post, I briefly mentioned it in the query rqStudyGroupRoster; the fields ValidTo and Paid have different formats (Default Display Type).
After removing the function USDate as you mentioned, could you also please change in the query ‘rqStudyGroupRoster’ the ‘Default Display Type’ of the field ‘Paid ‘from ‘ShortDate‘ to ‘_Text’.
Let me know how it goes.
Regards,
Elton S
I can’t even run the report query (in design mode) for some reason. Query is rqStudyGroupRoster. This should be able to run regardless of whether the output type is _Text or ShortDate, right? but now it returns no data. why is it so fragile, it was just running??? There should be 2 different rosters that show. I was able to run it earlier today and yesterday, and when I changed the default display types of the 2 fields, it stopped working. Is it possible to figure out why the query itself no longer returns records?
In order to run this query at design-time, I have to load it in the query designer, then find the 2 places near the bottom containing AND clauses for UserKey, and switch the comments from the parameterized version to the hard-coded-value version. Normally I can switch these then run the query right from the desinger, then when everything works, exit the query without saving so the parameterized version is restored.
Please ignore immediate prior comment. This was PEBCAK error. I can get the report to run properly now.
However, I think the problem is related to using the ShortDate display format in the 2 date fields. This format causes the date to be displayed as m/d/yyyy format, as desired.
What isn’t desired is the field value itself is now in m/d/yyyy format, and thus cannot be compared with other dates without some manipulation. As a programmer, I made the assumption that the display format is not the same thing as the actual field value. In all my years of programming, the actual field value wasn’t changed just because I used a display format different from the default date format. Apparently Five does not work the expected way, but instead actually modifies the date value to match the display format.
While I may disagree with how Five handles this, I can work with it. Now when I restore the default display type to _Text, and put “USDate “ before the field names in the template, it works. Inspector shows logged date values are yyyy-mm-dd as expected, and the report displays as mm/dd/yyyy as desired.
This topic can now be closed. Thanks so much for your help so far…