Page 2 of 4
Re: Changing text based on a field value
Posted: Mon Feb 05, 2018 5:40 pm
by JohnW
It was asking for the first IIF to have a false return value. Said the parameter was missing, so I added it (' "") '). That resolved that error but now I get this error:
The error of compilation
The error of compilation is found in the 'Text' property of the 'Text_2' component:
Expression expected.
A curly bracket issue? It looks right to me otherwise.
Here is my/your current code
Code: Select all
{IIF((liqMast.LicenseTypeCode == "MBI" || liqMast.LicenseTypeCode == "BKR" || liqMast.LicenseTypeCode == "DIM" || liqMast.LicenseTypeCode == "REP"), "RENEWAL APPLICATION FOR REPRESENTATIVE'S ID CARD - $20","")
IIF((liqMast.LicenseTypeCode == "FWN" || liqMast.LicenseTypeCode == "MNB" || liqMast.LicenseTypeCode == "W32" || liqMast.LicenseTypeCode == "WLQ" || liqMast.LicenseTypeCode == "WLQBR" || liqMast.LicenseTypeCode == "WMB" || liqMast.LicenseTypeCode == "WMBBR" || liqMast.LicenseTypeCode == "WWN" || liqMast.LicenseTypeCode == "WWNMFR" || liqMast.LicenseTypeCode == "LQRMFR"),"RENEWAL APPLICATION FOR SALES PERSON'S ID CARD - $35", ""))}
Re: Changing text based on a field value
Posted: Mon Feb 05, 2018 11:17 pm
by Alex K.
Hello,
Please check the following expression:
Code: Select all
{IIF((liqMast.LicenseTypeCode == "MBI" || liqMast.LicenseTypeCode == "BKR" || liqMast.LicenseTypeCode == "DIM" || liqMast.LicenseTypeCode == "REP"),
"RENEWAL APPLICATION FOR REPRESENTATIVE'S ID CARD - $20","")}
{IIF((liqMast.LicenseTypeCode == "FWN" || liqMast.LicenseTypeCode == "MNB" || liqMast.LicenseTypeCode == "W32"
|| liqMast.LicenseTypeCode == "WLQ" || liqMast.LicenseTypeCode == "WLQBR" || liqMast.LicenseTypeCode == "WMB"
|| liqMast.LicenseTypeCode == "WMBBR" || liqMast.LicenseTypeCode == "WWN" || liqMast.LicenseTypeCode == "WWNMFR" || liqMast.LicenseTypeCode == "LQRMFR"),
"RENEWAL APPLICATION FOR SALES PERSON'S ID CARD - $35", "")}
Thank you.
Re: Changing text based on a field value
Posted: Tue Feb 06, 2018 1:06 pm
by JohnW
I have tried the code. I get 5 instances of this error
The error of compilation
The error of compilation is found in the 'Text' property of the 'Text_2' component:
Expression expected.
I looked at the code output and this is the Sub that is created.
Code: Select all
Public Sub Text_2__GetValue(ByVal sender As Object, ByVal e As Stimulsoft.Report.Events.StiGetValueEventArgs)
'CheckerInfo: Text Text_2
e.Value = ToString(sender, IIF((liqMast.LicenseTypeCode == "MBI" || liqMast.LicenseTypeCode == "BKR" || liqMast.LicenseTypeCode == "DIM" || liqMast.LicenseTypeCode == "REP"),
"RENEWAL APPLICATION FOR REPRESENTATIVE'S ID CARD - $20",""), true) + ""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10) + ToString(sender, IIF((liqMast.LicenseTypeCode == "FWN" || liqMast.LicenseTypeCode == "MNB" || liqMast.LicenseTypeCode == "W32"
|| liqMast.LicenseTypeCode == "WLQ" || liqMast.LicenseTypeCode == "WLQBR" || liqMast.LicenseTypeCode == "WMB"
|| liqMast.LicenseTypeCode == "WMBBR" || liqMast.LicenseTypeCode == "WWN" || liqMast.LicenseTypeCode == "WWNMFR" || liqMast.LicenseTypeCode == "LQRMFR"),
"RENEWAL APPLICATION FOR SALES PERSON'S ID CARD - $35", ""), true)
End Sub
Re: Changing text based on a field value
Posted: Tue Feb 06, 2018 1:19 pm
by JohnW
Also as you can see I am getting the Syntax Error in the lower left corner of the text box. Should I be putting this code in a variable first or does it make a difference?

- Ashampoo_Snap_2018.02.06_07h14m02s_005_.png (31.98 KiB) Viewed 8602 times
Re: Changing text based on a field value
Posted: Tue Feb 06, 2018 7:53 pm
by Alex K.
Hello,
Please send us your report with test data for analysis.
Thank you.
Re: Changing text based on a field value
Posted: Wed Feb 07, 2018 7:52 pm
by JohnW
How do I send the file you if I don't want it on the forum?
Re: Changing text based on a field value
Posted: Wed Feb 07, 2018 9:39 pm
by Edward
Hi John,
Please email it to support[at]stimulsoft.com
Thank you,
Edward
Re: Changing text based on a field value
Posted: Thu Feb 08, 2018 6:06 pm
by JohnW
I have tracked part of the issue. It appears the code you were providing is C#. I use VB.Net So when I convert to VB see below it partially works.
It does not seem to like having a second IIF statement. If I delete the second IIF it runs. If I put it back in it fails
NOTE: The expression editor says 'OR" statements are not valid even though they do run and gives an error message in the lower left. A bug?
Here is the code I have at the moment
Code: Select all
{IIF((liqMast.LicenseTypeCode = "MBI" OR liqMast.LicenseTypeCode = "BKR" OR liqMast.LicenseTypeCode = "DIM" OR liqMast.LicenseTypeCode = "REP"),
"RENEWAL APPLICATION FOR REPRESENTATIVE'S ID CARD - $20","")}
{IIF((liqMast.LicenseTypeCode = "FWN" OR liqMast.LicenseTypeCode = "MNB" OR liqMast.LicenseTypeCode = "W32"
OR liqMast.LicenseTypeCode = "WLQ" OR liqMast.LicenseTypeCode = "WLQBR" OR liqMast.LicenseTypeCode ="WMB"
OR liqMast.LicenseTypeCode ="WMBBR" OR liqMast.LicenseTypeCode = "WWN" OR liqMast.LicenseTypeCode ="WWNMFR" OR liqMast.LicenseTypeCode = "LQRMFR"),
"RENEWAL APPLICATION FOR SALES PERSON'S ID CARD - $35", "")}
Re: Changing text based on a field value
Posted: Thu Feb 08, 2018 6:12 pm
by JohnW
I have this working now. In VB the IIF also does not like multi-line statements. It needs to be all on one line.
It would be nice if you could add an IF-THEN ELSE statement to the programming shortcuts. Its pretty commonly used in coding so I am sure the user base would like it.
Re: Changing text based on a field value
Posted: Thu Feb 08, 2018 7:43 pm
by Alex K.
Hello,
We have fixed some problems with VB language.
We have added these tasks to our to-do list. We will try to fix it in the near future.
Thank you.