PDA

View Full Version : WebGet psValue of oWebDateForm gets different date format than before



F. Gutiérrez
10-Jun-2020, 10:14 AM
Hi

I’m using the ReportView Wizard with a desktop web app in DF 20 Alpha 1 + DF Reports 20 Technology Preview. The generated code for the filters is identical to 19.0 but I have detected this behavior which is different.

This procedure would get the value of 2 dates for a filter in the report:



Procedure SetFilters
String sReportId
String[] sDateFilters

Get psReportId to sReportId
WebGet psValue of oFromMOVIFECHA to sDateFilters[0]
WebGet psValue of oToMOVIFECHA to sDateFilters[1]

// Todo: Check if you want the values to be sorted for hi-low correction or not
If (Not (IsNullDateTime (sDateFilters[0]))) Begin
Get DateToString of oReport sDateFilters[0] to sDateFilters[0]
Send AddFilter sReportId "{MOVI.FECHA}" C_drGreaterThanOrEqual sDateFilters[0]
End
If (Not (IsNullDateTime (sDateFilters[1]))) Begin
Get DateToString of oReport sDateFilters[1] to sDateFilters[1]
Send AddFilter sReportId "{MOVI.FECHA}" C_drLessThanOrEqual sDateFilters[1]
End
End_Procedure


In 19.0 the date’s format is local. For example: sDateFilters[0]=”10/06/2020”

In 20.0 Alpha 1, the date looks like ISO 8601: sDateFilters[0]=”2020-06-10”

So this line will fail:



Get DateToString of oReport sDateFilters[0] to sDateFilters[0]


Because the date becomes “0-00-20” and the report will not yield results.

Is this a bug or does WebGet for a date field now return an ISO 8601 format? If it is like this, it could be breaking (for example, moving that to a Date variable will fail).

As an aside, the ReportView Wizard (and others) have trouble bringing Unicode characters back to the Studio. For example, the Spanish for "selection" (“selección”) will become “selecci├│n.”

Samuel Pizarro
10-Jun-2020, 11:29 AM
Well

DateToString expects a date variable as input. You are passing a string. So an implicitly conversion takes place, using your local environment settings which does not match with your ISO str format.

Instead of WebGet the firm value to a sting var, have you tried to get it directly to a date variable? If the form has the proper datatype set, getting its value to date var should work

F. Gutiérrez
11-Jun-2020, 05:14 AM
Hi Samuel

Yes, this is directly generated from the report integration wizard and when you specity a range of dates for a filter, the procedure creates an array of String. I imagine it's becuse WebGet psValue is String anyway. In Alpha 1 I ended commenting out:



Get DateToString of oReport sDateFilters[0] to sDateFilters[0]


To avoid the double conversion and it worked. I imagine it's the report engine which needs the date in ISO format, thus the conversion.

Now in Alpha 2, WebGet psValue of the date form gets the value again as it used to (for example, 11/06/2020). So I think there was a bug (the change log mentions 'Fix for psValue of DEO's. The web property number support broke the psValue implementation of cWebBaseDEO.')...

Samuel Pizarro
11-Jun-2020, 07:46 AM
Good to know

thanks for the details