The function returns a
string literal containing the chars of the digit and % symbol to be stored in the field. LiveCode is not a strongly typed language and so it will do its best to make sense of what values you give to any operator. In this case, however, it won't be able to calculate a numeric value multiplied by a string. You may as well be asking it to give the answer "what do you get if you multiply 6 times idiotic?".
If you need to calculate with the value returned from the function then I would suggest you change the function to
or return 7, or return 5, etc, etc (without quotes, and without the % symbol) and store the numeric value in the field "UO %age". Add a label field to the screen showing the % symbol next to the "OU %age" field if you feel it looks better that way.
Then when you multiply the values, it will be numeric and calculate properly. 15 is not the same as 15% though, so multiplying by the returned value will be 100 times too much, of course, but you will be able to do
Code: Select all
put (fld "Price Input" * fld "UO %age" / 100) into field "UO"
BUT. Make sure the last calculation is done outside the function. You want a
handler to do some things, which involves calling a function (sending information to it, and expecting a returned value) and then do some things with that value - it's not part of the function.