If else statement in VB script
Hi all,
how to create vbscript for the if else statement? I got linked my label file to database (Oracle) and there is few fields. I want my data source/displayed text show YES or NO based on some field item/content. For example, if item begin with '191', then 'NO', else 'YES'.
Or can it be set in bartender database filter etc?
Please advise. Thank you.
-
Enter the following code in onprocessdata:
if left(value,3)="191" then value="NO" else value="YES"
1 -
Similar to the above, but as some of the data is coming from a database I would suggest you make the label field itself a Visual Basic field set as an Event Controlled Script. You should then select the OnNewRecord option so the VB is applied only when a new database record field is selected.
Once linked to a database you can reference the database fields directly from the column on the right by double clicking on them (ie for the example below I typed in Value = and then double clicked on the Code field to add the rest).
You can set the Then and Else parameters as required either typing them into " " or else double clicking on a different database field if that is what you need.
I hope this helps
1 -
Thank you to both KT and Peter. Due to not enough time, I set it as user input upon print (form). I will try above logic.
0
Please sign in to leave a comment.
Comments
3 comments