 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
pdupuis
Joined: 04 Jan 2007 Posts: 22
|
|
Type Mismatch Error |
|
Hi,
I don't understand why I have the "Type Mismatch" error while running this script (at line 5):
Dim date_today, String, @T"dd-mm-yyyy"
Dim date_endofmonth, String, @ME"dd-mm-yyyy"
Dim is_same, Boolean
isEqual date_today, date_endofmonth, is_same
if is_same, MODA, MODB
MODA:
MODB:
Please could you help?

|
|
Mon Jun 04, 2007 10:21 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7949
|
|
|
|
The values are all numeric, specified as strings, yet not in entered with quotes, which breaks the parser. The following would do what you want
 |
 |
Dim date_today, String, "@T"yyyy-mm-dd""
Dim date_endofmonth, String, "@ME"yyyy-mm-dd""
Dim is_same, Boolean
isEqual date_today, date_endofmonth, is_same
if is_same, MODA, MODB
MODA:
MODB: |
or alternatively you can use
 |
 |
Dim diff, number
DateDiff "@T"yyyy-mm-dd"", "@ME"yyyy-mm-dd"", diff
if diff, MODA, MODB
MODA:
MODB: |
|
|
Mon Jun 04, 2007 10:38 am |
|
 |
LeeD
Joined: 17 May 2007 Posts: 311 Country: New Zealand |
|
|
|
Hi, I'm having a similar problem with the following code; the Errorseverity variable is pulled from an INI file using inifilegetkey, and the isequal gives type mismatch whether it is populated or not.
//set the error severity if it's not set
dim nosev, boolean
IsEqual( Errorseverity, "", nosev )
if (nosev, setsev, actionstart)
setsev:
set Errorseverity, "4"
actionstart:
|
|
Mon Mar 31, 2008 5:23 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7949
|
|
|
|
It cannot compare numbers against empty strings as it doesn't know the data type of the empty value
Try this
 |
 |
dim GotSev, number
length( ErrorSeverity, GotSev )
if (GotSev, actionstart, setsev) |
|
|
Mon Mar 31, 2008 5:33 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|