Type conversion error for DateFormula

liizzliizz Member Posts: 125
Hello all,

How to modify a field which is of DateFormula datatype?

Am getting this error 'Type conversion is not possible. DateFormula:=Text'.

Infact, I have done a SETFILTER on that field and using the MODIFYALL afterwards.

Thanks

Liizz

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Can you show your code and explain the requirement please?
  • David_SingletonDavid_Singleton Member Posts: 5,479
    liizz wrote:
    Hello all,

    How to modify a field which is of DateFormula datatype?

    Am getting this error 'Type conversion is not possible. DateFormula:=Text'.

    Infact, I have done a SETFILTER on that field and using the MODIFYALL afterwards.

    Thanks

    Liizz

    You will need to use the EVALUATE command, you can't directly assign text to dateformula

    so


    MyText := FORMAT(MyDateFormula);
    Will get the DateFormula as text

    and

    if evaluate(MyDateFormula,MyText) then
    ;
    Will convert text to DateFormula.
    Should work.
    ...
    David Singleton
  • lakshmivallurulakshmivalluru Member Posts: 168
    Basically, you can use SETFILTER on dateformula data type.
    you have to do it as david said for each record.

    But if we are talking about 100's of records, the best thing will be add a text field to the table. when you assign a value to dataformula field, convert it into text and assign it to text field. so in code you can filter on this text field and modify all records.
    LR
  • liizzliizz Member Posts: 125
    Ok.

    I will try it out.

    Liizz
  • liizzliizz Member Posts: 125

    But if we are talking about 100's of records, the best thing will be add a text field to the table. when you assign a value to dataformula field, convert it into text and assign it to text field. so in code you can filter on this text field and modify all records.

    Can you please give me more details about how to proceed.

    I just want to update a field 'Period' of datatype DateFormula from 1D to 2D.

    Thanks
    Liizz
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Simply run the table from Object designer
    Place the Cursor on field which you want to modify. (in your case it is Period)
    Select Edit-->Replace (it will open Period - Replace window)
    Enter 1D in "Find What"
    Enter 2D in "Replace With"
    Click "Replace All"
Sign In or Register to comment.