xsharp.eu • Date issue - extremely frustrating!
Page 1 of 4

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 2:33 am
by Anonymous
Hi again. I have one screen where no matter what I do, the date will not format correctly. I've stuck SetDateFormat, SetDateCountry and SetInternational all over the place trying to get it to work, and nothing makes any difference. I've wasted hours on it. Below are images displaying the correct format, and another where the date is incorrect. The incorrect screen is called by pressing the "List Jobs" Button. This is the code:

METHOD ListJobsButton( ) CLASS JobInfo
Local oRecord as string

SetDateFormat("dd/MM/yyyy")
SetInternational(#Clipper)

oRecord := self:Server:FIELDGET(#CLCODE)

If self:oSFJobInfo_DETAIL:CurrentView == #FormView
self:oCCListJobsButton:Caption := "View Record"
self:oSFJobInfo_DETAIL:Server:OrderScope(TOPSCOPE, oRecord)
self:oSFJobInfo_DETAIL:Server:OrderScope(BOTTOMSCOPE, oRecord)
self:oSFJobInfo_DETAIL:GoTop()
self:oSFJobInfo_DETAIL:ViewTable()
ELSE
self:oSFJobInfo_DETAIL:ViewForm()
self:oCCListJobsButton:Caption := "List Jobs [F4]"

END IF

RETURN self

The properties for the window are attached as is the Fieldspec for the problem field. Any ideas would be greatfully received. Thanks

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 4:40 am
by Jamal
Looks strange! As if the DataBrowser is not respecting the SetDateFormat.
It's been a long time since I used DataBrowser (I now use bBrowser), but I think you can get better control if you use the DataColumn class to create the data columns. Something like this (not tested):

LOCAL oColumn AS DataColumn
LOCAL oServer AS DbServer

oServer := DbServer{"yourserver.dbf"}

SELF:use(oServer )

SELF:Browser := oSFJobInfo_DETAIL{SELF}

oColumn := DataColumn{}
oColumn :width := 15
oColumn :HyperLabel:= HyperLabel{#JOBDATE}
oColumn:Caption := "Job Date"
oColumn:FieldSpec := DateFS{} // your fieldspec
SELF:browser:addColumn(oColumn )

SELF:ViewAs(#BrowseView)

Jamal

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 4:54 am
by BiggyRat
Thanks very much Jamal, I'll try that right now, and you're right, it does seem to be ignoring the SetDateFormat. That's what's so frustrating!

UPDATE: No, that didn't work either Jamal... Here's the code I used:

local oColumn
SetDateFormat("dd/MM/yyyy")
oColumn := DataColumn{}
oColumn :Width := 15
oColumn :HyperLabel:= HyperLabel{#JOBDATE}
oColumn:Caption := "Job Date"
oColumn:FieldSpec := DateFS{#JOBDATE} // your fieldspec
self:browser:addColumn(oColumn )

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 5:19 am
by robert
Jeff,

Try SetCentury(TRUE). Does that make a difference ?

Robert

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 5:37 am
by BiggyRat
Nope, sorry Robert, but thanks :)

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 6:38 am
by Karl-Heinz
Hi Jeff,

Hard to believe that Roberts SetCentury ( TRUE ) advice doesn´t help ....

SetInternational (#Clipper) sets SetCentury() to false. Therefore, you must add a setcentury (true) after the SetInternational (#Clipper).

SetInternational(#Clipper)
SetCentury(TRUE)

Just tried it with the VO-Databrowser. In a date column the year is correctly shown, either with 2 or 4 digits - without any attached fieldspec.

Seriously asked: Is there more than *one* SetInternational (#Clipper) call in you app ?

regards
Karl-Heinz

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 6:54 am
by Jamal
Confirming what Robert and Karl said:

This does not work:

Code: Select all

  SetCentury(true)            // Does not work here
  SetDateFormat("dd/MM/yyyy")    
  SetInternational(#Clipper) 
This works:

Code: Select all

  
  SetDateFormat("dd/MM/yyyy")    
  SetInternational(#Clipper) 
  SetCentury(true)  // MUST be set after SetInternational(#Clipper) 
Jamal

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 7:36 am
by BiggyRat
Thanks Jamal and Karl-Heinz, but it seems much more sinister things are at work. VO Crashed completely and could't access the repository, So I deleted the whole thing and copied my backup copy of VO onto my PC (not installed, as I've stated before, I have no idea where my VO CD is.)

Whatever I do, I cannot get my app to run at all. I've re-indexed the project, and I get all sorts of varying errors at runtime like my Main Menu is an unknown class etc. On top of that I'm still getting an error in CAVOPP.DLL as I wrote the other day, it crashed exactly at 14 seconds to go every compile. It crashes with the "sorry!" screen, I restart VO and and compile again, it restarts where it left off, and compiles.

Also attached it the current error when trying to start my app. I'm guessing a DLL error, but I have NFI which one...

So now, I'm trying to rebuild the repository, and I get the attached message. Seriously It was never this hard. VO always worked like a dream, now I struggle to get the damn thing to stay stable.

I've asked this before without much success, but does anyone have a full install file that I can wipe my entire PC and start with VO 2.8SP4 fresh? There are just too many things going wrong with my version, and I think every time I copy it back from my old files, I'm probably re-importing the same problems.

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 12:36 pm
by robert
Jeff,
If you mail me your VO 2.8 SP4 serial number, then I will verify that number.
If the number is correct then I'll mail you a download link for a SP4 installer.

Robert at XSharp dot EU

Date issue - extremely frustrating!

Posted: Sat Jun 15, 2019 1:32 pm
by BiggyRat
Brilliant. Thank you so much Robert. Check your messages