Function overview
Prototype
SqlNumber (
number )
Parameters
number a numbervalue to be used in a sql-statement
Description
Tags:
Sql
When empty the value NULL is returned and when the value has a comma "," as decimal-separator the number will be converted to a number with the dot "." as decimal-separator.
This function is usefull in situations where multiple localisations are used or if you are in the netherlands where generally the comma "," is used as decimal-separator.
Examples
Sample input
SqlNumber ( 10.0 )
SqlNumber ( "" )
SqlNumber ( 15,5 )
Sample output
10.0 // where . allready is the decimal-separator
NULL
15.5 // as would be in dutch-localized files
Function code
// ####################
// ## SqlNumber function
// ##
// ## Author:
// ## Menno van Beek - STB Automatisering & Advies BV -
// ## Houten, the Netherlands
// ##
// ## Format:
// ## SqlNumber ( number)
// ##
// ## Parameters:
// ## Number - to be used in a ExecuteSQL()-calculation.
// ##
// ## Data type returned:
// ## text
// ##
// ## Description:
// ## When empty the value NULL is returned and when the
// ## value has a comma "," as decimal-separator
// ## the number will be converted to a number
// ## with the dot "." as decimal-separator.
// ##
// ## February 24, 2013
// ####################
Let ( [ value = If ( GetAsNumber ( "10.0" )=100 ; Substitute ( GetAsNumber ( number ) ; [ "," ; "." ] ) ; GetAsNumber ( number ) ) ] ; If ( value ≠ "" ; value ; "NULL" ) )
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/351
Prototype: SqlNumber( number )
Function Author: menno (http://www.fmfunctions.com/mid/391)
Last updated: 25 February 2013
Version: 1
*/
// ===================================
// ####################__LITBR__// ## SqlNumber function__LITBR__// ##__LITBR__// ## Author:__LITBR__// ## Menno van Beek - STB Automatisering & Advies BV -__LITBR__// ## Houten, the Netherlands__LITBR__// ##__LITBR__// ## Format:__LITBR__// ## SqlNumber ( number)__LITBR__// ##__LITBR__// ## Parameters:__LITBR__// ## Number - to be used in a ExecuteSQL()-calculation. __LITBR__// ##__LITBR__// ## Data type returned:__LITBR__// ## text__LITBR__// ##__LITBR__// ## Description:__LITBR__// ## When empty the value NULL is returned and when the__LITBR__// ## value has a comma "," as decimal-separator__LITBR__// ## the number will be converted to a number__LITBR__// ## with the dot "." as decimal-separator.__LITBR__// ##__LITBR__// ## February 24, 2013__LITBR__// ####################__LITBR____LITBR__Let ( [ value = If ( GetAsNumber ( "10.0" )=100 ; Substitute ( GetAsNumber ( number ) ; [ "," ; "." ] ) ; GetAsNumber ( number ) ) ] ; If ( value ≠ "" ; value ; "NULL" ) )__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/351__LITBR____LITBR__ Prototype: SqlNumber( number )__LITBR__ Function Author: menno (http://www.fmfunctions.com/mid/391)__LITBR__ Last updated: 25 February 2013__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================