This techdoc explains the workarounds that can be used to achieve correct results for the following CR’s that are known in Sybase Technical Support.
1.) CR 210277 When setting a display format with a european date format eg. German dd.mm.yyyy in a HTML datawindow the wrong datesequence in the HTML gets generated. This causes problems when trying to update the date, when the user tries to put in the date in the local format.
This CR should be fixed in PB 7.0.3 and PB 8.0.3 and higher.
2.) CR 207244/147261 DDDW Display of date format changes to a format of yyyy-mm-dd when getting focus.
This workaround still applies to the PB versions PB 7, 8 and higher.
1.) Description of the problem:
Normally the date sequence which is generated by the Jaguar component should be determined by the language settings in the control panel. According to the HTML preview this is what gets generated:
// it indicates the order of days (this is mm/dd/yyyy)
var DW_PARSEDT_monseq = 0;
var DW_PARSEDT_dayseq = 1;
var DW_PARSEDT_yearseq = 2;
To overcome this problem the date sequence needs to be adjusted to the language settings. In order to implement this for the previous example (dd/mm/yyyy) the generated HTML needs to be modified before being passed back to the client.
This can be done by modifying the HTMLGenerator component ie. by extending
the code in the generate() method of nv_remote_datawindow allows the correct
HTML to be passed back to the client browser.
The method looks as follows:
if ib_trace then of_log_enter("Generate()")
ls_result = ids_datastore.Describe("DataWindow.Data.HTML")
// This is the date order without modification
//var DW_PARSEDT_monseq = 0;
//var DW_PARSEDT_dayseq = 1;
//var DW_PARSEDT_yearseq = 2;
// This should be the date order for German date sequence dd.mm.yyyy
//var DW_PARSEDT_monseq = 1;
//var DW_PARSEDT_dayseq = 0;
//var DW_PARSEDT_yearseq = 2;
string DW_PARSEDT_monseq ="DW_PARSEDT_monseq = 0" //Month-String to be found
string DW_PARSEDT_dayseq ="DW_PARSEDT_dayseq = 1" //Day-string to be found
string DW_PARSEDT_monseq_new ="DW_PARSEDT_monseq = 1" //Replacement for default month
string DW_PARSEDT_dayseq_new ="DW_PARSEDT_dayseq = 0" //Replacement for default day settings
position = pos(ls_result, DW_PARSEDT_monseq ) //Gets the variable position in the html code
ls_result = Replace ( ls_result, position, 21, DW_PARSEDT_monseq_new )
position = pos(ls_result, DW_PARSEDT_dayseq ) //Gets the variable position in the html code
ls_result = Replace ( ls_result, position, 21, DW_PARSEDT_dayseq_new )
if ib_trace then of_log_exit("Generate(), length = " + String(Len(ls_result)))
2.) Description of the problem:
Assume you have a normal tabular datawindow containing a date column. This date column should be of type dropdowndatawindow to allow users to select special predefined dates having the formating of dd/mm/yyyy.
The base column (here column start_date) should also have the dd/mm/yyyy format. The nature of the problem is, that when the column gets focus, the date format changes from dd/mm/yyyy to yyyy-mm-dd which can be confusing to the user. Dropping down the datawindow shows the values again in the right format dd/mm/yyyy.
Base datawindow column of type date. (here column start_date)
Dropdowndatawindow column also of type date, using a special formatting eg. dd/mm/yyyy or dd.mm.yyyy
Language settings according to the special formatting, here dd/mm/yyyy.
The code needs to be in the itemfocuschanged of the base datawindow and a special defined unmapped userevent, which gets triggered by the itemfocuschanged code.
//Example with date field in Employee table !!!
w_sheet.triggerevent ("ue_displayvalue") //w_sheet is the window having the userevent and dw on it
rownumber = string(dw_1.getrow())
displayvalue = dw_1.describe("Evaluate( 'lookupdisplay(start_date) ', "+rownumber+" )")