LaRetta Posted February 7, 2003 Posted February 7, 2003 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
Ugo DI LUCA Posted February 7, 2003 Posted February 7, 2003 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...
LaRetta Posted February 7, 2003 Author Posted February 7, 2003 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
Ugo DI LUCA Posted February 7, 2003 Posted February 7, 2003 Strange but it does work for me... field num = $75,25 calcnegative = filed num -(fieldnum*2) = -75,25 setfield field num (calcnegative) = -75,25
LaRetta Posted February 7, 2003 Author Posted February 7, 2003 Thanks Ugo! Yes, I think I've just reached brain-death. Of course it works when I enter it right Thanks for helping! LaRetta
Ugo DI LUCA Posted February 7, 2003 Posted February 7, 2003 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
djgogi Posted February 7, 2003 Posted February 7, 2003 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
LaRetta Posted February 8, 2003 Author Posted February 8, 2003 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
Recommended Posts
This topic is 7963 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now