¿ªÔÆÌåÓý

Calc Error


 

So I am trying to create an if statement with a calc inside. It keeps kicking an error.

***ERROR on line 12 of table 'Age of Ambition Background' - : 'Input string was not in a correct format.'. ***

This is the line from the table:

_{if~%pRaceNum% = 3 ? |DieHolder={Dice~1d10}||pAge={Calc~(120+(10 x 15))}|}

Originally it said this:

_{if~%pRaceNum% = 3 ? |DieHolder={Dice~1d10}||pAge={Calc~(120+(%DieHolder% x 15))}|}

They both give the same error. So what am I missing?


 

You need to use * instead of x for multiplication.

_{if~%pRaceNum% = 3 ? |DieHolder={Dice~1d10}||pAge={Calc~(120+ (10*15))}|}

Erol K. Bayburt
ErolB1@...

On 9/22/2020 1:25 AM, wooterslw@... wrote:
So I am trying to create an if statement with a calc inside. It keeps kicking an error.
***ERROR on line 12 of table 'Age of Ambition Background' - : 'Input string was not in a correct format.'. ***
This is the line from the table:
_{if~%pRaceNum% = 3 ? |DieHolder={Dice~1d10}||pAge={Calc~(120+(10 x 15))}|}
Originally it said this:
_{if~%pRaceNum% = 3 ? |DieHolder={Dice~1d10}||pAge={Calc~(120+(%DieHolder% x 15))}|}
They both give the same error. So what am I missing?


 

Well, I feel stupid. Thanks!


 

I also thought the "if" needed to be capitalized, e.g.
_{If~%pRaceNum% ...
instead of
_{if~%pRaceNum% ...


 

The help file says that TableSmith is case sensitive when it comes to variable names and group names & calls. But it apparently isn't case sensitive when it comes to function names. E.g. Calc, calc, and CALC all seem to work, likewise If, if, and IF.

Comparisons ignore spaces, but seem to be case sensitive. three = Three evaluates as false, in an If function, while three = three evaluates as true.

Erol K. Bayburt
ErolB1@...

On 9/23/2020 9:30 AM, sdavies2720 via groups.io wrote:
I also thought the "if" needed to be capitalized, e.g.
_{If~%pRaceNum% ...
instead of
_{if~%pRaceNum% ...