0800 083 7663
SOLCASE TIPS - APRIL 2007
CHECK WHETHER A FIELD IS NUMERIC
Those of you who have written in Visual Basic or VBA will be aware of the useful IsNumeric function which returns a value of true or false depending on whether a particular field is a true number or not.
Unfortunately there is no such function in Solcase or Visualfiles but you can achieve the same result with the code below.
Note the removal of commas,spaces and decimal points from the string before testing.
This code assumes that the field or string being tested is
numeric until it comes across a character that is not numeric. The code
tests the whole string and as soon as it finds a character that is
not 1,2,3,4,5,6,7,8,9 or 0 it switches the flag to false.
article by Richard Arney
SEG USER FORUM
Unfortunately we have had to suspend this useful service as some users objected to publication
ABOUT PARASOL
Parasol was originally conceived in 2005 to provide expert help for solicitors struggling to get a return on their investment and make the best of their Solcase or Visualfiles installation.
The Parasol Consultancy Group was initially set up by:-
Richard Arney
Affik Choudhury
Andrew Hall
Tim Long
Bryan Tulloch
SAMPLE CODE
[&Assign TF01=""]
[&Assign TF02=""]
[&Assign TF03=""]
[&Assign TF04=""]
**Enter String
[&Assign TF01='Enter
Text String'] (or assgn ABC01 or whatever to TF04)
[&Assign TF04=TF01]
[&If TF04<>""]
** remove commas
[&Assign TF04=TF04("REPLACE(",","")]
** remove decimal point
[&Assign TF04=TF04("REPLACE(".","")]
**
remove spaces
[&Assign
TF04=TF04("REPLACE(" ","")]
[&EndIf]
** check not blank and set default answer
[&If TF04=""]
[&Assign
TF03="false"]
[&Else]
[&Assign
TF03="true"]
[&EndIf]
** Loop through each character
[&DoWhile TF04<>""]
[&Assign TF02=TF04:Char(first=1,number=1]
[&Assign TF04 = TF04:char(first=2,number=5000)]
**Check each character to see if any character is not a number
[&If TF02 &IsOneOf "0,1,2,3,4,5,6,7,8,9"]
[&Else]
[&Assign TF03="false"]
** exit loop because
a non-numeric char was found
[&Assign TF04=""]
[&EndIf]
[&EndDowhile]
** Show result
[&Message "IsNumeric
= " + TF03]