Hello experts,
I need import text file into NAV using XMLport. Duration format is below text type. But duration has another format in NAV. How can I convert a text data into duration type?
Example:
text is '00:08:06:07' -> duration:8 min 6 sec 7milsec
Regards,
Undy
0
Answers
Have you tried the EVALUATE statement
DurVal is:00:08:09:07
First:
AllText:=COPYSTR(DurVal,1,2)+COPYSTR(DurVal,4,2)+COPYSTR(DurVal,7,2)+COPYSTR(DurVal,10,2);
EVALUATE(All,AllText);
MESSAGE('%1',All);
Result is: 3371 days 3 hours
Second:
hourText:=COPYSTR(DurVal ,1,2)
EVALUATE(hour,hourText);
MinText:=COPYSTR(DurVal ,4,2);
EVALUATE(min,MinText);
SecText:=COPYSTR(DurVal ,7,2);
EVALUATE(sec,secText);
MSecText:=COPYSTR(DurVal ,10,2);
EVALUATE(Msec,MsecText);
MESSAGE('%1, %2 , %3 , %4 ',hour,min,sec,MSec);
results is: , 8 hours , 9 hours , 7 hours
I want to insert a DurVal into NAV table. How can I solve it?
Best Regards,
Undy
Duration is just a number.
Since you split the value, you can just do the following (The magic numbers are just conversion to milliseconds):
Hope this helps
It helps a lot