Hi All,
I have a script that runs great by itself, in the autoexec or from a button on a form.
But......
When I use it on a button on a toolbar it fails. Why?
Here is what I'm using:
In the autoExec: script_play_local("CnCCal").......works
In a button on a form: script_play_local("CnCCal").......works
In a button on the toolbar: script_play_local("CnCCal").......Fail
Specifically I get this error:
Script: CncCal: Line:62
myendDate=names[x}.Shortedate+duration
names[x].Shortedate+duration:Argument is incorrect data type
Which refers to this part of the script:
for x=1 to arr_count
myendDate=names[x].cncdatea+duration
if names[x].tassigned = "custom" then
eventCol="blue"
end if
if names[x].tassigned = "cabinets" then
eventCol="green"
end if
if names[x].tassigned = "office" then
eventCol="orange"
end if
proname="-"+trim(lookupc("F",names[x].group_id,"jobname","sales","Group_Id"))
myname="{id: "+names[x].pnum+", text: "+"""+names[x].operation+proname+"""+",start_date: "+"""+date_format(names[x].cncdatea,"MM-dd-yyyy")+"""+", end_date: "+"""+date_format(myendDate,"MM-dd-yyyy")+"""+", color: "+"""+eventcol+"""+"},"+crlf()'names[x].Shipduration
longstring=longstring+myname
next x
I don't understand why the error when running from a toolbar button
Any help solving this would be appreciated.
Thank you
I have a script that runs great by itself, in the autoexec or from a button on a form.
But......
When I use it on a button on a toolbar it fails. Why?
Here is what I'm using:
In the autoExec: script_play_local("CnCCal").......works
In a button on a form: script_play_local("CnCCal").......works
In a button on the toolbar: script_play_local("CnCCal").......Fail
Specifically I get this error:
Script: CncCal: Line:62
myendDate=names[x}.Shortedate+duration
names[x].Shortedate+duration:Argument is incorrect data type
Which refers to this part of the script:
for x=1 to arr_count
myendDate=names[x].cncdatea+duration
if names[x].tassigned = "custom" then
eventCol="blue"
end if
if names[x].tassigned = "cabinets" then
eventCol="green"
end if
if names[x].tassigned = "office" then
eventCol="orange"
end if
proname="-"+trim(lookupc("F",names[x].group_id,"jobname","sales","Group_Id"))
myname="{id: "+names[x].pnum+", text: "+"""+names[x].operation+proname+"""+",start_date: "+"""+date_format(names[x].cncdatea,"MM-dd-yyyy")+"""+", end_date: "+"""+date_format(myendDate,"MM-dd-yyyy")+"""+", color: "+"""+eventcol+"""+"},"+crlf()'names[x].Shipduration
longstring=longstring+myname
next x
I don't understand why the error when running from a toolbar button
Any help solving this would be appreciated.
Thank you
Comment