Internet technologies and communication software



Problem with %IF macro
Search  Users  Rules 
Close
Login:
Password:
Forgot your password?
Register
Login
 
Pages: 1
RSS
Problem with %IF macro
 
As Registrar for a science-fiction convention (V-Con 31), I want to send a confirmation message to each of our members. The membership records are kept in Excel; I exported the list from Excel and imported it into the TB! address book, using some of the address-book fields to hold some special values in the spreadsheet. Generally, the template comes out pretty well, but I'm having trouble with a part of it:

------------------------
You are%IF:"%ABToBusFax"<>"":"":" not" registered for the Writing Master Class.
You are%IF:"%ABToBusPager"<>"":"":" not" registered for the Writers' Workshop.

%IF:'&ABToCompany'='':"%-":"
You are registered with a Dealer-room table in
the name of %ABToCompany.

"
-------------------------------

The first couple of lines ("You are/are not registered...") come out fine--if the respective fields are blank, the "not" prints, if not, not.

The part about the Dealer-room table, however, always prints, even if %ABToCompany is blank. I've tried various combinations of single and double quotes, ="" and <>"", including a blank like before the final quote mark and not, using "%-" and not; "You are registered with a Dealer-room table in the name of " always prints, with a name when %ABToCompany is non-blank, and empty when it is.

Can anyone tell me what I'm doing wrong here, or give me some pointers on how to do it right? I simply want to print that "You are registered..." paragraph, and the following blank line, if and only if %ABToCompany is non-blank. (Even better would be if I could get the line to wrap correctly, ignoring the space taken up by the macro stuff, which causes wrapping in the template. But that's minor.) Many thanks. --Howard
 
You're using a mix of single quote marks and double quote marks in the last if statement, change the all to double quote marks. Also you're using &ABToCompany in stead of %ABToCompany.

Change your template into:

You are%IF:"%ABToBusFax"<>"":"":" not" registered for the Writing Master Class.
You are%IF:"%ABToBusPager"<>"":"":" not" registered for the Writers' Workshop.

%IF:"%ABToCompany"="":"%-":"
You are registered with a Dealer-room table in
the name of %ABToCompany.

"
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Argghh! Here I was trying all sorts of fancy stuff, and it turns out that I was just mis-spelling %ABToCompany!! (In weak defence, I was also doing some stuff with SAS, which uses "&" for macro variables.) Changed the "&" to "%" and everything worked fine. Many many thanks for finding such an embarrasing error. Cheers, --Howard
Pages: 1
Users browsing this topic (1 guests)