Well, unfortunately "format" does make a string representation of the number, although Rev, being a decently helpful soul, will try to make the best sense of the values it is presented with. If it weren't for the percentage or currency symbol, or the commas, then even represented as strings Rev should be able to make the calculations.
So, you could strip the currency/percent symbols and commas before making the calculations.
Or, you could have a "duplicate" hidden field that you get the setProp handler to populate with the unadjusted numeric value specified.
Or, probably the best way, you could put the line:
as the last line of the setProp handler (and similarly with the other setProp names of course). That will allow Rev to actually set the custom property specified (so becoming a legitimate custom property of the field instead of a virtual property). If you look in the Property Inspector for the relevant field, and see the custom property pane, currently there will be nothing shown. If you include the "pass" line in each relevant handler, then after a setProp handler has dealt with the task, you will see the property has been stored against the field in question.
Then when you need to retrieve the value for calculation, instead of
Code: Select all
set the cDisplaySepCurrency of field "Purchase_Price_1" to 50000
set the cDisplayPercentage of field "Output_Purchase_Deposit" to 15
put field "Purchase_Price_1" into v_Purchase_Price
put field "Output_Purchase_Deposit" into v_Purchase_Deposit
put (v_Purchase_Price * v_Purchase_Deposit) into v_Deposit
you would have
Code: Select all
set the cDisplaySepCurrency of field "Purchase_Price_1" to 50000
set the cDisplayPercentage of field "Output_Purchase_Deposit" to 15
put the cDisplaySepCurrency of field "Purchase_Price_1" into v_Purchase_Price
put the cDisplayPercentage of field "Output_Purchase_Deposit" into v_Purchase_Deposit
put (v_Purchase_Price * v_Purchase_Deposit) into v_Deposit
You could always shorten that to:
Code: Select all
set the cDisplaySepCurrency of field "Purchase_Price_1" to 50000
set the cDisplayPercentage of field "Output_Purchase_Deposit" to 15
put the cDisplaySepCurrency of field "Purchase_Price_1" * the cDisplayPercentage of field "Output_Purchase_Deposit" into v_Deposit
Because you can round or otherwise adjust the value before displaying it in the field, you might need to bear in mind that the "passed" custom property may not literally be the same as the displayed one. (Eg in the example I gave for the percentage, the 73.7135 that was rounded in the field to 74% would have the cDisplayPercentage property value of 73.7135 still.)
(You can round the value to the same as the display beforehand if necessary, but you would have to then specificially set the cDisplayPercentage of the target to the newly rounded value
inside the setProp handler - so in order to avoid a runaway recursion, you would also need to lock messages before the value was set. Otherwise you would trigger another setProp to happen, which would do the same again, and trigger another, etc etc). HTH, and don't worry too much about the last bit unless you have to - I don't want to muddy the waters too much, as I would love to help clarify the mystery of custom and virtual properties, not make it more murky.