Want to remove Char from the DATE

JAYESHJAYESH Member Posts: 290
HI to all...

I have posting date like - c05/06/07.

I am trying to export the date from the dataport.

I want to remove C while they export data.

The posting date must look like 05/06/07.

I request you to please share ur ideas..

Thank you..
JAYESH PATEL

Answers

  • SavatageSavatage Member Posts: 7,142
    did you try using FORMAT & DELCHR?

    Format the date field & delchr the result

    PS When you export theis closed date the "c" actually appears?
  • JAYESHJAYESH Member Posts: 290
    i format date in to string.

    And i used DELCHAR to remove C from the date.

    But I want to store value what i got in to DATE field again to export.

    LIKE

    DT - Text

    DT := FORMAT(DATE);
    DT := DELCHAR(DT,'=',C);

    How i store STRING value in to DATE it's not possible

    DATE := DT ---- NOt possible..

    be'z the DATE is DATAPORT filed which is exported from the dataport.

    Thank you...
    JAYESH PATEL
  • SavatageSavatage Member Posts: 7,142
    aren't you exporting it to a text file anyway? why do you need it to be put back into a date type variable?

    http://www.mibuso.com/forum/viewtopic.p ... nvert+date

    I'm not a codemaster but I think you could combine (not tested)
    EVALUATE(DELCHAR(FORMAT(DATE),'=',C),varDate);
  • JAYESHJAYESH Member Posts: 290
    The date is field of Table

    I used that table and mention date fileds as DATAPORT filed.

    So i must have to store the value which i got at end to store in to date filed.

    I think then only they gonna export date in the format which i got...

    Thank you
    JAYESH PATEL
  • SavatageSavatage Member Posts: 7,142
    JAYESH wrote:
    The date is field of Table
    I used that table and mention date fileds as DATAPORT filed.
    So i must have to store the value which i got at end to store in to date filed.
    I think then only they gonna export date in the format which i got...
    Thank you

    Not sure if that makes any sence but I hoped I helped a little 8)
  • JAYESHJAYESH Member Posts: 290
    By using this its done..i remove the C from the Date and the data is now exported with out include C in to the Date field.

    Boo - is boolean
    Dt - Text
    DAT - Date

    DT := FORMAT("G/L Entry"."Posting Date");

    DT := DELCHR(DT,'=','C');

    Boo := EVALUATE(DAT,DT);

    IF Boo = TRUE THEN

    "G/L Entry"."Posting Date" := DAT;

    Thank you for your support...
    JAYESH PATEL
  • SavatageSavatage Member Posts: 7,142
    JAYESH wrote:
    Boo - is boolean
    Dt - Text
    DAT - Date

    feel free to be descriptive with your Variables - it will help one day down the road when you review the dataport and go "what was I thinking"?

    :lol:

    I'm pretty sure you can eliminate the boo

    Boo - is boolean
    Dt - Text
    DAT - Date
    DT := FORMAT("G/L Entry"."Posting Date");
    DT := DELCHR(DT,'=','C');  
    EVALUATE(DAT,DT);
    "G/L Entry"."Posting Date" := DAT;
    
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Savatage wrote:
    ...I'm not a codemaster but I think you could combine (not tested)...

    Not sure about that, :mrgreen: from some of your posts lately, looks like you are becoming a developer. I always say that the best Navision programmers are always those that started out on the End User side having had to struggle with problematic code.

    =D>
    David Singleton
  • SavatageSavatage Member Posts: 7,142
    cleanDATE:=(DELCHAR(FORMAT(DATE),'=',C));
    EVALUATE(cleanDATE,varDATE);

    does that look better (still not tested) I'm sure on the first error message I'd figure it out [-o<
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Savatage wrote:
    cleanDATE:=(DELCHAR(FORMAT(DATE),'=',C));
    EVALUATE(cleanDATE,varDATE);

    does that look better (still not tested) I'm sure on the first error message I'd figure it out [-o<

    Actually there are lots of ways to do this. I would want to address the issue that the user enters bad text, so would change it to:
    cleanDATE:=(DELCHAR(FORMAT(DATE),'=',C));
    IF NOT EVALUATE(cleanDATE,varDATE) THEN
      varDATE := 010101D; // <- or workdate or what ever.
    
    David Singleton
  • jreynoldsjreynolds Member Posts: 175
    Look at the FieldNames that are possible when formating a date. You will find that the standard formats generally include the 'Closing' field (which is where the 'C' comes from) but you can build a custom format that does not include this.

    I'm not really sure what you are trying to do but you should also check out the NORMALDATE and CLOSINGDATE functions.
Sign In or Register to comment.