Strugglinh with "IF"

Hi,

I'm trying to use the IF-Function. Unfortunately I can't find an example how the syntax is exactly.

The Documentation says:

IF(<Expression>, String1, String2)

Okay - I just want to have the second row in am memo read "-" in case a value is true and otherwise display another field's value...

So while

["km" #N#,##0.0] km
[IF(["Storniert"]='True', '-', ' km')]

works fine, FR crashes with an empty(!) Error Message (just an OK-Button in it) while creating a report using

["km" #N#,##0.0] km
[IF(["Storniert"]='True', '-', '["Endstand" #N#,##0.0]')]

I also tried to use FormatFloat - but every time I try to print a field-value within the "else"-condition I get this empty error message...

Any ideas?

Cheers,

Mark


Comments

  • edited 10:00AM
    Well, as support from the manufacturer can be rated 0 of 10: I finally found out that it's a bug:

    ["km" #N#,##0.0] km
    [IF(["Storniert"]='True', '-', '["Endstand" #N#,##0.0]')]

    doesn't work as I try to format the value. If I write

    ["km" #N#,##0.0] km
    [IF(["Storniert"]='True', '-', '["Endstand"]')]

    instead it works - but in this case I don't get the value formatted. So I'll have to use a workaround.

    Well - you guys at FR: I hope you do read the forum at least, even if no answers are given here. So it might be that these bugs will be corrected in one of the future versions.

    Kind regards,

    Mark Meyer
  • gordkgordk St.Catherines On. Canada.
    edited 10:00AM
    hi mike it isn't a bug it is how the internal parser works plus the fact that you are working with variant strings and tstring of string lists in some cases
    If you use the expression builder it will build the syntax for you.
    if using a fmt function the mask must be enclosed with ' ' you are trying to pass a string value, the internal parser strips ' just like delphi.
    An expression can have up to 3 parameters,but a parameter can have an expression with up to 3 params so you can create very complex expressions very easily. one of the easiest ways to add or change format masks is to create
    dictionary variables containing the masks you want as string expressions then all you need to do is insert the variable where required.
    regards ;)

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.