February 7, 200323 yr Hi everyone! I am importing a set of data. My fields are number. The data is listed as $73.15. I have written a script to remove the $ and change the amount to a minus. The script does remove the $ but doesn't add the minus! I assume it's because my fields are numeric? Any suggestions on how to accomplish this? GoTo Record/Request/Page [ First ] Loop Set Field [ Charges, Substitute( Charges, "$" , "-" ) ] Set Field [ AmountAllowed, Substitute( AmountAllowed, "$" , "-") ] Set Field [ Payment, Substitute( Payment, "$", "-") ] Set Field [ CoPay, Substitute( CoPay, "$", "-") ] Set Field [ Withhold, Substitute( Withhold, "$", "-") ] Set Field [ FFSEquity, Substitute( FFSEquity, "$", "-") ] Set Field [ COBDeduct, Substitute( COBDeduct, "$", "-") ] Go to Record/Request/Page [ Next, Exit after last ] End Loop LaRetta
February 7, 200323 yr Well -73,15 = 73,15- (73,15*2). you could have a calc for that and then a setfield command in your script. Sure there will be another solution though...
February 7, 200323 yr Author Hi Ugo! Well that didn't work. I even tried "Charges" - "Charges" and that made all numbers "0" YIKES! This shouldn't be difficult! UPDATE: Duh! Charges - Charges = 0 of course I changed it to Charges - Charges * 2 and it worked!! Okay, okay, I've been up all night! LaRetta
February 7, 200323 yr Strange but it does work for me... field num = $75,25 calcnegative = filed num -(fieldnum*2) = -75,25 setfield field num (calcnegative) = -75,25
February 7, 200323 yr Author Thanks Ugo! Yes, I think I've just reached brain-death. Of course it works when I enter it right Thanks for helping! LaRetta
February 7, 200323 yr Here is the file. i'm almost sure Andy or others would come with a relationship calc using constant OnetoOne and no script at all Will wait and see
February 7, 200323 yr Hi LaRetta, Ugo Well, as I see the things (laRetta), the script you gave fail to success simply because those fields are numbers and when casting the contents of the field to number (and that's what is happening as the result of set field with numeric result of calculation) the $ signs(or any other non numeric char except -) is droped and there is nothing to replace with "-" . So instead use simply: Set Field[theNumericField,(-1)*theNumericField] Dj
February 8, 200323 yr Author Hi Ugo and DJ! That worked perfectly! Thanks to both of you. Actually, using SET in this way has sparked quite a bit of interest in me. LaRetta
Create an account or sign in to comment