IIF with expressions

Mikel.PahlMikel.Pahl Karlsruhe
edited March 2007 in FastReport 4.0
We want dependig on Databasefield postfach print the Datafiled strasse or the datafield postfach with the word Postfach in front.

We have tried saveral combinations like this one:
[IIF(<QFili."POSTFACH">='',<QFili."STRASSE">,"[Postfach <QFili."POSTFACH">]")]
But it dosent work.


this works:
[IIF(<QFili."POSTFACH">='',<QFili."STRASSE">, <QFili."POSTFACH">)]
an this too
[IIF(<QFili."POSTFACH">='',<QFili."STRASSE">,'Postfach')]


Is ist possible to combine Datafiled and Textobjects in the false or true expressions of IIF

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 8:31PM
    whatch your string delimiters
    [IIF(<QFili."POSTFACH">='',<QFili."STRASSE">,'Postfach '+<QFili."POSTFACH">)]
  • Mikel.PahlMikel.Pahl Karlsruhe
    edited 8:31PM
    gordk wrote:
    whatch your string delimiters
    [IIF(<QFili."POSTFACH">='',<QFili."STRASSE">,'Postfach '+<QFili."POSTFACH">)]
    Thank you. Now it works.

    In another Report is now an Castproblem remaining in the IIF:

    [IIF(<Rechnungen_Lauf."SKONTO">=0,'',<Rechnungen_Lauf."SKONTO">+' bis '+<Rechnungen_Lauf."SKONTODATUM">)]

    Exception of Calss EVariantTypeCasError
    Variant of this Type (String) could not convertet to Type (Currency)


    Datafield Rechnungen_Lauf."SKONTO is Currency
    Datafield Rechnungen_Lauf."SKONTODATUM" is Date
  • gordkgordk St.Catherines On. Canada.
    edited 8:31PM
    The iif function returns one variant or other variant.
    if the the display format of the memo is set to something other you may get a bad type cast error. so you must add required functions around true value, false value members.
    another way is to use the obp event of the band or memo to alter the contents of the memo and use inline formating tags in your expressions
    ie
    if <datafield> > 0.00 then
    begin
    memo1.text := '[expression]' +' ' +'[expression with format tag]'
    end
    else
    begin
    memo1.text := other value
    end;
    see the user manual chapter on inline formatting

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.