Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3350 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

 I importing a  huge list as text files from FileBuddy which gives me file names, file location and file size fields
Importing the text list in the Filemaker database the "SIZE" field is populated with text so I am unable to sort the sizes as numbers. 

the SIZE field looks as follows: 
EXAMSPLEs
666,73 MB
1,36 GB
432 KB
How to I write a script so the "SIZE" text field can be converted in an integer?
Example of possible results:
if the text field is 921,5 MB the resulting number should be 921500000 
or
if the text field is 2,16 GB the resulting number should be 2160000000 from
or
if the text field is 89 KB the resulting number should be 89000

The syntax in the fields is always the same
digits followed with a space then KB or MB or GB. Some include a ","

Any help highly appreciated

Edited by dkey
editing
Posted

You could try this calculation as the option of auto-entering a calc for that field:

Let([
n = GetAsNumber ( Self ) ;
t = RightWords ( Self ; 1 )
] ;
n * 
Case(
t = n ; 1 ;
t = "KB" ; 10^3 ;
t = "MB" ; 10^6 ;
t = "GB" ; 10^9 
)
)

 

Posted

Thanks a great lot Raybaudi it works like charm .... I really must try and leanr the LET function as it seems to solve all kind of problems

Regards

 

This topic is 3350 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.