Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running code from memo fields and ExecScript
Message
From
25/02/2008 15:42:10
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01296122
Message ID:
01296211
Views:
10
Borislav

That works fine and dandy, for that instance.

Unfortunately, we also call this function and pass no other parameters, ie:

ExecMemo(carrier.carr_send)

The code horked at this, so I added:
  If lnPcount > 0
    lcParList = LEFT(m.lcParams, ATC([,], m.lcParams,m.lnPcount)-1)
  Else
    lcParList = ''
  endif
  Try
    If Empty(lcParList)
      retval = Execscript(memoString)
    else
     retVal = EXECSCRIPT(memoString, &lcParList)
    endif
  CATCH TO oError
With no parameters, if I leave the "&lcParList" in place, I get "Function argument type, value or count invalid" and without the ParList, I get "Syntax Error"

I was momentarily un-vexed, and the help file is so NOT helpful on ExecScript.

>That also should work and you'll have one macro less and one loop less.
>Just try it. There is no need to change anything in your function (except missing comma :-)))
>
>>yup, I'm sure.
>>
>>I really don't want to change the function, as it works for every other carrier, just not this one.
>>
>>>>uh....yeah, it is. That was one of the first things I checked :-)
>>>
>>>Sure?
>>>
>>>SELECT carrier
>>>BROWSE FIELDS carr_270 NORMAL
>>>ExecMemo(carrier.carr_270, InputTableName) && No quotes around first parameter
>>>
>>>FUNCTION execMemo(memoString, p1, p2, p3, p4, p5)
>>>  LOCAL lcParams, lcParList, lnPcount
>>>  lcParams  = [p1, p2, p3, p4, p5]
>>>  lnPcount  = PCOUNT()-1
>>>  lcParList = LEFT(m.lcParams, ATC([,], m.lcParams,m.lnPcount)-1)
>>>  TRY
>>>     retVal = EXECSCRIPT(memoString, &lcParList)
>>>  CATCH TO oError
>>>  ENDTRY
>>>RETURN
>>>
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Reply
Map
View

Click here to load this message in the networking platform