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]
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
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.
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
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.
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!
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
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.
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.
[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??
"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.
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.
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.
Thanks again!