dates and if

edited January 2014 in FastReport 4.0
The problem goes like this.

I have 2 fields that represent some amount of money. (a and B )

Also there is a field that contains date (i.e. 10/01/2014) (d) .

All three are taken from SQL query.

I need to complete two more fields.

1st - if date d has already passed then I need to write down into the field the result of A - B, else 0.
2nd - if date d has already passed then I need to write down the amount of days that had passed, else "" (empty string). (Today is 21/01/2014, so I need to write "11")

I tried like this for the 1st one but it always throws errors.

[IIF(<frxDBDatasetPlApm."DATUMS"> < <Date>, <frxDBDatasetPlApm."KOPSUMMA"> - <frxDBDatasetPlApm."APMAKS_SUM">,"0.00")]

Comments

  • gordkgordk St.Catherines On. Canada.
    edited January 2014
    try adding more braces ie.
    [IIF((<frxDBDatasetPlApm."DATUMS"> < <Date>), (<frxDBDatasetPlApm."KOPSUMMA"> - <frxDBDatasetPlApm."APMAKS_SUM">),"0.00")]

    if this does not work for you use the obp event of the databand to write code to set the vakue of the memos text.
  • edited 12:37AM
    Hi.

    I think the IIF wants single quotes, not double:

    [IIF(<frxDBDatasetPlApm."DATUMS"> < <Date>, <frxDBDatasetPlApm."KOPSUMMA"> - <frxDBDatasetPlApm."APMAKS_SUM">,'0.00')]

    Petter
  • edited 12:37AM
    Petter S. wrote: »
    Hi.

    I think the IIF wants single quotes, not double:

    [IIF(<frxDBDatasetPlApm."DATUMS"> < <Date>, <frxDBDatasetPlApm."KOPSUMMA"> - <frxDBDatasetPlApm."APMAKS_SUM">,'0.00')]

    Petter

    That was it! Thanks!!!



    Any ideas about the second task?
  • edited 12:37AM
    problem solved. [IIF(Trunc(<Date>)-Trunc(<frxDBDatasetPlApm."APMAKS_LIDZ">) >0, Trunc(<Date>)-Trunc(<frxDBDatasetPlApm."APMAKS_LIDZ">) ,' ')]

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.