Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is a parameter an array?
Message
From
11/11/2003 22:19:46
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
11/11/2003 21:12:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00848944
Message ID:
00848961
Views:
22
This message has been marked as the solution to the initial question of the thread.
You want to ascertain that a parameter, like par1, is an array, right?
if type("par1(1)") # "U"
  * it is an array
endif
>Hi all,
>
>I have a multi-function processor, sort of like a train station (methoddirector). It holds parameters passed from various functions and then sends them on (for various reasons).
>
>Okay, I have methodX on a form:
>
>
*-- this will send some data and an array to the application.methoddirector
>LOCAL lnReturn, laMyArray, lcMyString, lnMyNumber
>DIMENSION laMyArray[1,4]
>laMyArray[1,1] = 'This number'
>laMyArray[1,2] = 4
>laMyArray[1,3] = 'is spelled'
>laMyArray[1,4] = 'four'
>lcMyString = 'Testing Four'
>lnMyNumber = 4
>lnReturn = application.methoddirector(lcMyString, @laMyArray, lnMyNumber)
>
>Okay, so far... the PARAMETERS() of application.methoddirector will catch all of this fine...
>
>
*-- method.methoddirector
>PARAMETERS pItem1, pItem1, pItem1, pItem1, pItem1, pItem1,
>DO CASE
> CASE PCOUNT()=1
>  lnReturn = mehtod.oneparamterthingy(pItem1)
> CASE PCOUNT()=2
>  lnReturn = mehtod.oneparamterthingy(pItem1, pItem2)
> .....
>ENDCASE
>RETURN lnReturn
>
>I hope you can see the problem here. One of the items I passed in the first codeblock was an array. It might not be an array all the time, or anytime, based on what is sending data to the method.director. I need to be able to ascertain if there is an array passed to method.director which will need to have the '@' inserted.
>
>When I do have to pass an array item, from a passed parameter array item, how do I determine if ANY parameter is an array?
>
>
>TIA
>
>Ric
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform