SqlNumber ( )

Function stats

Average user rating
5.0000
391
351
9999
Support
FileMaker 7.0 +
Date posted
25 February 2013
Version
1
Recursive function
No

Author Info
 menno

4 functions

Average Rating 5.0

author_avatar



 

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

*/
// ===================================

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)