Kirix Support Forums

Conversion Functions

Please post any help questions, requests or other feedback here.

Conversion Functions

Postby huntch on Wed Aug 08, 2007 11:44 am

Does the function set include any conversions? When I import a table from some sites, numeric data comes in as character and I can't see any method to treat it as numeric.

Thanks,
Chris
huntch
Registered User
 
Posts: 1
Joined: Wed Aug 08, 2007 11:30 am

Re: Conversion Functions

Postby Ken on Wed Aug 08, 2007 12:26 pm

Strata does have conversion functions. Two options for you:

1. If you go to the View Menu and select the Design view, you are presented with a structure editor. For those fields that you want to make numeric, you can click on the word "Character" in the Type column and use the drop-down menu to select Numeric. Toggle back to the Table view to see the change take place.

2. Alternatively, you can convert fields using calculated fields, which gives you a lot more precision. If you take a look at the screencast, you can see how to create calculated fields. The function you want to use for changing a character to a value is the val() function. For numeric to character you would use the str() function. From string to date you would use the date() function.

Our documentation is poor at the moment, but you can see all the functions available to you to use in calculated fields here:

EDIT: The functions can currently be found here: http://www.kirix.com/olddocs/Category:SQL_Functions However, we're in the process of merging this information into our current help section. I'll repost the correct link when it is available.

A few other useful functions for use in cleaning up your data are trim() and lpad() and rpad().

Hope that helps,
ken
Ken Kaczmarek
Kirix Support Team
User avatar
Ken
Kirix Support Team
 
Posts: 147
Joined: Mon Dec 19, 2005 10:36 am

Re: Conversion Functions

Postby Ben on Mon Aug 13, 2007 10:21 am

Hello,

To convert from a string to a number, try using

Code: Select all
VAL( source_field )


To convert from a number to a character field, the following is used:

Code: Select all
STR( source_field, number of decimals )


Similarly, converting from a date to string looks like this

Code: Select all
STR( date_field )


Hope this helps,
Ben
Ben Williams
Kirix Support Team
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Return to Strata Help & Feedback