Forum Discussion
One thing I notice is that it seems there is a typo in the time-format for either the $exit_date value or the string-comparison expression.
I think "00:00.00.000"
should be "00:00:00.000"
.
(i.e. the minute:second delimiter a colon instead of period)
Also, Date.Parse() should be Date.parse() (lowercase ‘p’)
In any case, if the $exit_date value contains the time-format typo, then Date.parse() probably returns a NaN
value instead of null
or ''
(but I haven’t tested to confirm).
Sorry, Yes I had typos in my question: Here’s some more detail:
I have a Mapper Snap with this logic:
$exit_date!=’ ’ && $exit_date!=null && $exit_date!=‘00:00:00.000’?
Date.parse($exit_date).toLocaleDateString() : null
I am getting this error message on that snap:
Expression worked for 1 previous document, but failed on document #2 with the error: Not-a-number
(NaN) does not have a method named: toLocaleDateString, found in: …aleDateString(). Perhaps you meant: toString, toExponential, toPrecision, toFixed
Resolution:
Handle the NaN value by providing a default value, for example: ($exit_date!=‘’&&$exit_date!=null&&$exit_date!=‘00:00:00.000’)?(Date.parse($exit_date) || /* default */).toLocaleDateString():null
Reason:
‘toLocaleDateString’ was not found while evaluating the sub-expression ‘Date.parse($exit_date).toLocaleDateString()’
I tried the resolution and the same error appears
PIMData.txt (1.8 KB)
hi @bojanvelevski i was trying to frame that structure will share the sample input and xsd pls could u help pls
samplerecords.json (262 Bytes)
Please convert PIMData.txt to PIMData.xsd as the template is in that format
Please also find output expected xml in txt format
outputxml.txt (3.2 KB)Hi rashmi,
Good day, instead of using an xml generator snap have you tried the xml formatter? I don’t know if this is your required output but xml formatter accepts an outgoing format as XSD
XML output using PIMData.xsd
Updates:
,
I’m not that familliar with XSD so I manipulate the sample input using a mapper snap, attached poc pipeline
canvas 15_2022_12_03.slp (16.8 KB)
Thanks,
EmEm
Related Content
- 3 years ago