Options

Dataport to import date, but wrong format.

kikkomankikkoman Member Posts: 57
I am working on a dataport where I am importing some fields, of course. well, there is a field that I need to import, which so happens to be a date field. The date field in Navision is set to be US, so its MM/DD/YY. The field that I am importing is in format DD/MM/YY.
Ex. 23/1/2005 (this will not work b/c 23 is not a month, only 1-12, but if I change it to 1/23/05, and my dataport works b/c its in the format that I can use)

I have tried looking up format(), but doesn't seem to work with this scenario, I think. :-k b/c I will never be able to as date := text field

So what I did was hard coded it, where the import is assigned a text field, and the I break the text field correctly and switch the numbers around and get it into the format that I need, which is MM/DD/YY. Now the problem is that I can't assign this new text to the date field in the job journal line b/c of mismatched types.
"Job Journal Line"."Posting Date" := newtext; //newtext = 1/23/05
so my question is, what is the best way to do this? it seems like there could be a function that could do this without me having to hard code it, ......but i don't mind...i enjoy it!!!....but if someone could help me on this ...it would be GREAT!!!! i need a way to convert the incoming date to my format!

THANKS,

Comments

  • Options
    SteveOSteveO Member Posts: 164
    I think you are looking for the EVALUATE(variable, text) command.
    Check the help for all the syntax and comments.

    This command casts text into the datatype of the variable. Has a return value to say whether or not the conversion was successful.
    This isn't a signature, I type this at the bottom of every message
  • Options
    kikkomankikkoman Member Posts: 57
    thanks Steve0....that was what I needed....I would've never figured that out for along while!!!!....you da man!!! \:D/
Sign In or Register to comment.