Sage 100

 View Only
  • 1.  oSession properties for Time

    Posted 02-05-2019 14:57
    Hello, is there a oSession.SystemTime or something like that available like there is oSession.SystemDate. I need to know the time something is being triggered to fill it to a UDF.

    Thanks! 

    #scripting

    ------------------------------
    Dana Young
    Lehman Wesley & Associates
    Lansing MI
    ------------------------------


  • 2.  RE: oSession properties for Time

    Posted 02-05-2019 15:02
    https://www.w3schools.com/asp/func_now.asp

    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 3.  RE: oSession properties for Time

    Posted 02-05-2019 15:08
    Ok, thanks @Kevin Moyes  ​

    ------------------------------
    Dana Young
    Lehman Wesley & Associates
    Lansing MI
    ------------------------------



  • 4.  RE: oSession properties for Time

    Posted 02-05-2019 17:00

    You can use the GetStampInfo() method, same one that gets the TimeUpdated for many tables.

    sTimeNow = ""
    retVal = oSession.GetStampInfo(oSession.UserKey, oSession.SystemDate, sTimeNow)

    The only thing is let's say it's 7:45pm. sTime will return "19.75" so you have to convert the decimal to "19.45" or "7:45pm" if you want the "minutes in a hour" representation. 

    Otherwise just do this: 

    CurrentTime = Right("0" & Hour(Now),2) & ":" & Right("0" & Minute(Now),2) 'e.g. 19:45 means 7:45pm not decimal .75



    ------------------------------
    Alnoor Cassim

    Free Agent Developer and Consultant
    CallForHelp.biz
    Email: alnoor@callforhelp.biz
    Orange County, CA
    ------------------------------



  • 5.  RE: oSession properties for Time

    Posted 02-06-2019 14:01
    Thanks, @Alnoor Cassim !

    ------------------------------
    Dana Young
    Lehman Wesley & Associates
    Lansing MI
    ------------------------------



  • 6.  RE: oSession properties for Time

    Posted 02-06-2019 14:13
    Edited by Kevin Moyes 02-06-2019 14:14
    I'm not a fan of the decimal time format... in my first attempts to convert I had to be wary of translating 19.99 properly into 8:00pm (or 7:59pm) instead of 7:60pm.
    Alnoor's CurrentTime code is how I normally approach it in a vbscript.

    Tip: in Crystal, there is a nice formula to convert a Sage time field to something human readable.
    TimeValue(ToNumber({CI_Item.TimeCreated})/24)

    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 7.  RE: oSession properties for Time

    Posted 02-06-2019 14:33
    Kevin - Nice Crystal tip - thanks! Been looking for that.

    ------------------------------
    Alnoor Cassim

    Free Agent Developer and Consultant
    CallForHelp.biz
    Email: alnoor@callforhelp.biz
    Orange County, CA
    ------------------------------