project BLF > class Cacher > method GetValuesFromSession

Description

This method can be used to retrieve the values of more than one session dependent cached data items with one call. It avoids that the caller needs to do multiple "Get<datatype>Value" calls.


Parameters


iiSessionIdinputintegerThe unique ID of the session for which data item values need to be returend.
icNameListinputcharacterA comma separated list of names of data items for which the values need to be returned.
ocValueListoutputcharacterA chr(2) separated list of values that correspond with the list of data items that is passed in icNameList.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method business.ReadSessionValues

QadFinancials
method business.ReadSessionValues
method TExchangeRate.ApiGetExchangeRate


program code (program1/cacher.p)

<M-1 run UpdateSessionData (input  iiSessionId (iiSessionId), 
                            output oiReturnStatus (oiReturnStatus)) in Cacher>
if oiReturnStatus <> 0 then return.

assign viTotal = num-entries(icNameList).
do viCount = 1 to viTotal by 2:

    assign vcName = entry(viCount,icNameList)
           vcType = entry(viCount + 1,icNameList).
    
    find tCachedData where
         tCachedData.tcName = vcName and
         tCachedData.tcDataType = vcType no-error.
    if available tCachedData
    then assign ocValueList = ocValueList
                            + (if viCount = 1 then "" else chr(2))
                            + (if vcType = "d"
                               then if tCachedData.tdDecValue = ?
                                    then "?"
                                    else string(tCachedData.tdDecValue)
                               else if vcType = "i"
                               then if tCachedData.tiIntValue = ?
                                    then "?"
                                    else string(tCachedData.tiIntValue)
                               else if vcType = "l"
                               then if tCachedData.tlLogValue = yes
                                    then "TRUE"
                                    else if tCachedData.tlLogValue = no
                                         then "FALSE"
                                         else "?"
                               else if vcType = "t"
                               then if tCachedData.ttDateValue = ?
                                    then "?"
                                    else string(year(tCachedData.ttDateValue),"9999")
                                       + string(month(tCachedData.ttDateValue),"99")
                                       + string(day(tCachedData.ttDateValue),"99")
                               else if tCachedData.tcCharValue = ?
                                    then "?"
                                    else tCachedData.tcCharValue).
    else assign ocValueList = ocValueList
                            + (if viCount = 1 then "" else chr(2))
                            + "?".
end.