IIF Not Working

Hi, apologies if this is a basic question...

I have been supplied some software which has fast report built into it to design reports. On the pre-designed report everything is tagged in sqare brackets eg [name] [age]. On an old version I used I could create an IF statement eg:

[IF([name]=('NtK'),('OK'),('Not OK'))].

From reading through this forum, I understand that I should now format this like:

[IIF(<name>='NtK','OK','Not OK')] - but when I try this I get a blank field on my report.

I tried going back to basics and creating a [<Page>] field which works ok, but as soon as I add a [IIF(<Page>=1,'Test1','Test2')] field, I get an empty output.

It seems any expression apart from the basic tags won't work! [img]style_emoticons/<#EMO_DIR#>/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> Can anyone help please? Thanks[/img]

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 7:24PM
    the syntax [iff(condition is true,truevalue,falsevalue)] is correct for use in a memoview's memo and works fine.

    so make sure you set the memo visible
    [IIF(<Page>=1,'Test1','Test2')]
    also in some cases you may need to add () around the test condition so it will equate to true.
  • edited 7:24PM
    Hi, thanks for your reply

    I tried [IIF(<Page>=1,'Test1','Test2')] and tried [IIF((<Page>=1),'Test1','Test2')] and still I get nothing.

    I assume I'm in 'memoview' (although I can't see where it says this). I'm using version 4.2.68 and working with a .fr3 file. I have a code, data and page1 tab - and I'm on the page1 tab. When I right click on the field 'Visible' and 'Printable' are both checked.

    If I type anything before the [xxx] it prints ok, but anything between them doesn't work. :\

    Any more ideas?

    Thanks



  • gordkgordk St.Catherines On. Canada.
    edited 7:24PM
    [IIF(<Page>=1,'Test1','Test2')]
    works fine here
    tfrxmemoview placed on a page and contains the above expression.
    BTW "4.2.68" it always amazes me why one works with versions so far out of date when updates are free.
    current build is fr4.10.11
    make sure you haven't set the font color to none or white.
  • edited 7:24PM
    Can't get it to work still :\

    In report designer I drew a text box, clicked 'Insert Expression', then 'Classes' then clicked on TrfxMemoView = class(TrfxCustomMemoView), then typed in IIF(<Page>=1,'Test1','Test2') in the expression box. I closed everything and it created [IIF(<Page>=1,'Test1','Test2')] on my page. But still all my tags (including [Page]) work apart from this one. I have checked the font colour and checked it is visible - very confused!

  • gordkgordk St.Catherines On. Canada.
    edited 7:24PM
    this draw bit is throwing me? are you working with some ones limited designer(third party)? or a full version of fr 4 delphi.
    using fr4 s designer you would select the tfrxmemo view object from the tool bar drop it on the page and you would go into edit mode right away. in the edit window you would select the inser expression button and build the expression selecting the function, then typing in the other parameters and select ok.
    no mention of classes.
    post a zipped copy of your .fr3 file in the binaries news group and ill take a look at it
  • edited 7:24PM
    Lately I also have trouble with the IIF thing. There are cases where it doesn't work and I just can't see why not.
    I now started to handle it in the script. This seems to be a far easier way to handle conditions than struggle for ages with the IIF construct.
  • edited 7:24PM
    gordk wrote: »
    BTW "4.2.68" it always amazes me why one works with versions so far out of date when updates are free.
    current build is fr4.10.11
    When one uses packages and has ignorant users on a multi-user system then updating can become a bit of a mission.
    The user updates and after that his program fails to load with an error message. Frantic and irritated all to support "Whenever I update I have problems afterwards!" This is not good for customer relations. All along it was his fault by someone not having shut down their computer and keeping a lock on the BPL. Even you one points it out to him he will have forgotten tomorrow. What remains are the bad vibes between him and you.

    Yes, I can understand why people work with outdated versions. I am using packages far less than I used to but the modules have increased in size substantially. Probably not a problem when one lives in a developed country with a good internet infrastructre but if one lives in a place like Africa it is a different situation.
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 7:24PM
    Try something simpler, go further back to the basics:
    [IIF(true,'Test1','Test2')]

    and also

    [IIF(false,'Test1','Test2')]

    (I'm not sure if it requires markers around the true/false, so it might have to be [IIF(<true>,'Test1','Test2')]

    If these 2 examples work, I can only assume that <Page> = 1 is generating a quiet exception internally.
    HANG ON a minute!
    isn't it <PageNumber> that you need to use?
    Page is the tFrxPage object, isn't it??
  • gordkgordk St.Catherines On. Canada.
    edited 7:24PM
    Sorry Anu
    "HANG ON a minute!
    isn't it <PageNumber> that you need to use?"

    No
    Page is an fr system variable so <page> = 1 is a valid expression.

  • Anu de DeusAnu de Deus Hampshire, UK
    edited February 2011
    Ok, thanks.
    Anyway, I decided to test the expression in a fresh new report and it worked just fine.
    FR 4.10.6, Vista SP2, Delphi 2010 with all updates
    BTW, suggesting anyone to update to latest version of code is fine, forcing is definetly not fine.
    Each user has a version that works best for him, and updates can introduce new bugs (FR has done it in the past, just like any other software company, it??s natural) and be very painful.
  • gordkgordk St.Catherines On. Canada.
    edited 7:24PM
    That was what i did also.
    What i was trying to say was in relation to the updating
    if he is updating the project why update to such an old version of fr4?
    Waiting to see the .fr3 file.



  • edited 7:24PM
    Thanks for your suggestions on this. I'm out of the office today, I'll try tomorrow and get back to you!
    Thanks again!

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.