Answer Cmd

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Answer Cmd

Post by Glenn Boyce » Wed Mar 11, 2009 9:38 pm

I would like to display information contained in a number of variables in a dialogue box. I thought I'd use the "Answer' one and can incorporate one variable but can't seem to get it to work with more.

String I want is:
(variables are in brackets)

(tQty) "has been allocated against" (tItemNo) "on" (tDate)

any assistance welcome

cheers
Glenn

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Mar 11, 2009 9:49 pm

Use "&" to concatenate the elements you want to display. Use "&&" to concatenate with a space between the elements. So you can put

answer tQty && "has been allocated against" && tItemNo && "on" && tDate

and that should do the trick.

The brackets will force Rev to evaluate the variables before inclusion, but it sort of does that automagically under most circumstances so you shouldn't need to include them. You might want the brackets if you were constructing a lookup by concatenating a name with a numeral index, for example

Code: Select all

repeat with i = 1 to 9
 put i into field ("Field" & i)
end repeat
Which would put 1 into field "Field1" and 2 into field "Field2" etc etc. (Bad practice in some ways, but gives you the idea).

If you need to include quotes then you will need to do some extra, eg

answer "Field "Qty" has been completed" will fail because the opening quotes by "Qty" will be read as the closing quotes for the answer command.
So you would use the quote constant and concatenate as:

answer "Field" && quote & "Qty" & quote && "has been completed"

HTH.

Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Post by Glenn Boyce » Wed Mar 11, 2009 11:36 pm

Thanks. I must have done something wrong because I thought I had the syntax the same as you but it didn't work. Does now, thats the main thing!!

Post Reply