Focal Point
[SOLVED] issues with date related functions during migration

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/7627090196

February 04, 2019, 02:29 PM
satish chennupati
[SOLVED] issues with date related functions during migration
we are in a migration phase from ISM 6.1 to ISM 8.

one of our integration reads a file which has the following data


SOME-NMAE
-10
1


then we have a series of nested IFL functions that constructs a date out of the and based on passed values. 1 stands for today and -10 is go 10 days back from today to find some information.

_if(_isnumber(_qval(_xpath(//Download/FromDate))),_fmtDate('yyyy/MM/dd',_iadd(_iadd(_now(U),_dateof('dd',_qval(_xpath(//Download/FromDate)))),_dateof('dd',1))), _qval(_xpath(//Download/FromDate)))

1. i have updated the _now to _timer as recommended.
2. after this i get the following error



XML parsing error : XD[FAIL] cause: 0 subcause: 2 message: Parse failure: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
'-10'



any help on this ?

This message has been edited. Last edited by: FP Mod Chuck,


Data Migrator 7.7
service manager 6.0, 6.1, 6.5 and 8
February 05, 2019, 10:11 AM
dhagen
Those date functions do not work with negative values.

If you want to subtract from today, then try:
 _fmtdate('yyyy/MM/dd',_imul(_iadd(_timer('seconds'),_imul(86400,-10)),1000)) 
where the -10 is your value. It can be positive or negative in this case.

You will have to condition the use of 1 as a one in the above will get you tomorrow. So for today, this will work:
 _fmtdate('yyyy/MM/dd',_timer('milliseconds'))  



"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
February 11, 2019, 08:52 AM
satish chennupati
thanks for the reply Darryl, however what i am trying to do is a bit different.

the pflow reads a file which has the following info
   <Download>
        <Name>SOME-NAME</Name>        
        <FromDate>-10</FromDate>
        <ToDate>1</ToDate>
</Download> 


it takes the fromDate and toDate based on the numeric values passed and constructs a date using these. A negative value represents past date so here toDate will be today's date and -10 will be 10 days before.

in ISM 6.1.2 it is working fine (see the extract of log file)

setSREG(pre) name=FromDate/thread was='null' val=_if(_isnumber(_xpath(//Download/FromDate)),_fmtDate('yyyy/MM/dd',_iadd(_iadd(_now(U),_dateof('dd',_xpath(//Download/FromDate))),_dateof('dd',1))), _xpath(//Download/FromDate)) :=2019/01/29



but when i migrated this pflow to ISM 8.0.1 it is not working anymore. (see log below)

Exception in execute of _fmtdate('yyyy', _dateof('yyyy/MM/dd',_sreg('Fdate'))): XD[FAIL] cause: 0 subcause: 0 message: Unable to process function expression for function: dateof, parameter: 2; Value ''-10'' is not a valid date per the format in parm 1


i want to understand what i should modify so that it will work properly and constructs the dates.

from the release notes i only understood that instead of _now we need to use _timer which i tried and that didnt worked.


Data Migrator 7.7
service manager 6.0, 6.1, 6.5 and 8
February 19, 2019, 09:05 AM
satish chennupati
aha Darryl i understood now as to what you meant.

thanks it worked for me.


Data Migrator 7.7
service manager 6.0, 6.1, 6.5 and 8