Source language: Translate to:

Math

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Math

Postby smartmedia » Mon Feb 15, 2010 3:44 pm

Hi..

I use:
Code: Select all
dbpSetFieldProperties "Prosfora" "Products" "Price" "DisplayFormat=,#.00"

to present currency from database fields. Normally if the amount is for example 150000,89 i get 150.000,89 in Grid and in the texts that are presented. So far so good. Now the problem is that every time i try to do math with values like the above i get error. I suppose that the (.) dot inside the currency confuse the Math. Any idea how to override this without to loose the above format..

Thanks.
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Gaev » Mon Feb 15, 2010 3:54 pm

smartmedia:

If you want to convert something like 150.000,89 to 150000.89 ...
Code: Select all
StrReplace "[FieldX]" "!." "" "[Step1]" ""
StrReplace "[Step1]" "!," "!." "[Result]" ""

If you want to convert something like 150.000,89 to 150000,89 ...
Code: Select all
StrReplace "[FieldX]" "!." "" "[Result]" ""
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Neosoft Support » Tue Feb 16, 2010 11:08 am

You could also, temporarily remove the display format during the calculation, then restore it when finished.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby smartmedia » Wed Feb 17, 2010 12:27 pm

Hi..

I used StrReplace to remove the dot(.) and after dbpSetFieldProperties to re-format the results. The database use AutoSaveEdits It seems that if you make a change to a filed and then use dbpSetFieldProperties, the changes are not saved in record. You have to use dbpSaveEdits again in order to be sure that any changes are saved.
So for 10 math command i came up with a code of 30-40 lines. I think that in math command must added a output format for the variable.

Thanks
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Bing [Bot] and 2 guests