I'll pose this question here rather than sending a support request, because it may affect some other people sometime too.
Will the program process a Java Script if-Statement? If so, is a special syntax necessary? As far as I can see, the following if-Statement should be valid:
if (chkAnimalCompanion.Value == TRUE) {
'd20+'+(txtKnoMod.Value+txtAnimalCompanionSP.Value);
}
However, it throws a compilation error.
chkAnimalCompanion is a check box.
txtKnoMod and txtAnimalCompanionSP are text edit fields.
CS Designer seems to want apostrophes (single quotes) rather than real (double) quotes, but the statement above works with neither. The error also appears with a single = sign rather than a double (==).
Comments
You could though make a function on the script page, and call that from the field source.
function Prerequisite (TrueFalse, KnoMod, SP)
{
r = 0;
if (TrueFalse == TRUE)
{
r = KnoMod + SP;
}
return r;
}
... and I called it as follows:
Prerequisite (chkAnimalCompanion.Value, txtKnoMod.Value, txtAnimalCompanionSP.Value)
... in the Field Source box. However, the only result is to call the debugger.
It could also be that I'm doing more than CS Designer's up to.
One problem is the "TrueFalse == TRUE", which in JS, you'd just say "if (TrueFalse)" or "if (TrueFalse == true)", since 'true' in javascript is an actual identifier, as opposed to C++ where TRUE is a defined value.
if (TrueFalse)
works in C++ too, if the value of TrueFalse is right.
I assumed that VS also had the symbolic constant TRUE. Bad guess.
I also wasn't aware of the Checked property for a check box, as in:
chkAnimalCompanion.Checked
Once I get this thing done, I'll make it available, so that other users can see how to do a couple of things that aren't in the original samples.
Thanx,