Web Connection Wishlist
Few improvement wishes from Europe
Gravatar is a globally recognized avatar based on your email address. Few improvement wishes from Europe
  Petteri Koskela
  All
  Feb 6, 2017 @ 12:27am

Hi,

Thank You for this great product.

I am developing software here in Finland, Europe. We have different date format in use and this will produce problems using wwAsyncWebRequest.prg. Routines BuildSQLUpdateStatement() and BuildSQLUpdateStatement() use DTOC() and TTOC() functions. This will produce incorect SQL command when we are using european set('date') format - for example set date to german that will produce format dd.mm.yyyy.

I fixed this problem by changing DTOC() and TTOC() function by my own routins that format date and datetime values ignoring set date setting.

Another thing that is different here in Finland is that we are using week numbers for meetings etc. I have added this option to WebControlsJQuery.prg with two properties firstDay and showWeek and adding firstDay: and showWeek: options to jQuery datepicker definitions. Could these options be added to original code so I don't have to add this feature to each new version of Web Connection.

Thanks

Petteri

Gravatar is a globally recognized avatar based on your email address. re: Few improvement wishes from Europe
  Rick Strahl
  Petteri Koskela
  Feb 6, 2017 @ 12:40am

Thanks for the comments.

Routines BuildSQLUpdateStatement() and BuildSQLUpdateStatement() use DTOC() and TTOC() functions. This will produce incorect SQL command when we are using european set('date') format - for example set date to german that will produce format dd.mm.yyyy.

Hmmmmm... not sure I understand. Are you talking about wwSql? These routines use TimeToCStrict() which returns either FoxPro strict dates, or SQL universal dates:

************************************************************************
FUNCTION TimeToCStrict
****************************************
***  Function: Returns time in strict time format or in SQL Server
***            compliant format (llSql flag set).
***      Pass: Datetime value
***    Return: strict DateTime string, or SQL Server time string
************************************************************************
LPARAMETER ltTime, llSQL

IF llSQL
  IF EMPTY(ltTime)
     RETURN "''"
  ENDIF
  
  RETURN "'" + TRANSFORM(TTOC(ltTime,1),"@R 9999-99-99 99:99:99") + "'"
ENDIF

IF EMPTY(ltTime)
   RETURN "{^}"
ENDIF

RETURN "{^" + TRANSFORM(TTOC(ltTime,1),"@R 9999-99-99 99:99:99") + "}"

Either of these should work with any locale selection.

As to the the WebControlJquery settings can you show your changes, or send me your modified version of the file and I can do a compare on it to see if this makes sense for adding as a general purpose change operation.

If not the easiest way to fix this is to subclass and reference your subclass instead of the base class in the controls on the page (<ww:MywwDatePicker>). That way our updates won't affect your changed class.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Few improvement wishes from Europe
  Petteri Koskela
  Rick Strahl
  Feb 6, 2017 @ 01:39am

Hi,

No, I do not mean wwSql. I mean wwAsyncWebRequest.prg. There is SaveEvent() function that create entry in wwAsyncRequest table. This SaveEvent() call these BuildSQLInsertStatement() and BuildSQLUpdateStatement() routines.

They create sql statement that insert or update values to wwAsyncRequest. I did it like this in BuildSQLInsertStatement() and BuildSQLUpdateStatement().

      CASE lcType = "D"
         lvValue = EVAL("loData."+lcField)
*        lcValue = [']+IIF(EMPTY(lvValue),"",DTOC(lvValue))+[']
		 lcValue = [']+IIF(EMPTY(lvValue),"",SqlServerDate(lvValue))+[']
      CASE lcType = "T"
         lvValue = EVAL("loData."+lcField)
*        lcValue = [']+IIF(EMPTY(lvValue),"",TTOC(lvValue))+[']
  		 lcValue = [']+IIF(EMPTY(lvValue),"",SqlServerDateTime(lvValue))+[']
     ENDCASE

And I think if I would have used TimeToCStrict() function, result would be the same.

About wwWebControlsJQuery. I create two properties in class wwDatePicker. I used these defaults byt I think real default values should be 0 and false.

firstDay	= 1
showWeek	= .T.

Then I add this code in wwDatePicker's method onPreRender() just before where trailing comma is removed.

lcOption	= lcOption + "firstDay:" + alltrim(transform(this.firstDay, '9')) + ","
if This.showWeek
	lcOption	= lcOption + 'showWeek:true,'
endif


Thanks

Petteri

Gravatar is a globally recognized avatar based on your email address. re: Few improvement wishes from Europe
  Rick Strahl
  Petteri Koskela
  Feb 6, 2017 @ 12:17pm

Oh I see, sorry I missed the part about wwAsyncWebRequest. Yeah that code probably way predates the wwSQL code and TimeToCStrict(). One of these days I should take another look at async processing to see if there isn't a better way to do this 😃 That code is so clunky, but it works. IAC, changing the code to use TimeToCStrict() should be easy to do.

I'll take a look at the datepicker - that should be easy to add as well, although if I do the default with be .f..

+++ Rick ---

© 1996-2024