Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADDPROPERTY array
Message
 
 
To
26/04/2021 06:22:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01679967
Message ID:
01680010
Views:
36
>>>>Hi,
>>>>
>>>>Currently I pass a char variable tcAttachment to procedure by way of an empty object. Here is the brief extract:
>>>>
>>>>ADDPROPERTY( oParameter, "attachment", tcAttachment ) 
>>>>
>>>>Above code adds a variable tcAttachment to the object oParameter
>>>>
>>>>Then, code passes the parameter to some procedure EmailProc()
>>>>
>>>>lSuccess = EmailProc( oParameter )
>>>>
>>>>
>>>>Within EmailProc() the code extracts the parameter cAttachDoc
>>>>
>>>>cAttachDoc = oParameter.attachment
>>>>
>>>>
>>>>I need to change the character variable to the array. So, the top line will change to:
>>>>
>>>>ADDPROPERTY( oParameter, "attachment", taAttachment ) 
>>>>
>>>>In the above line the parameter taAttachment is now Array instead of the character. Will it work?
>>>>
>>>>TIA
>>>>
>>>>UPDATE. I found that I add the array to the oParameter as follows:
>>>>
>>>>ADDPROPERTY( oParameter, "attachment(2)", "DOC1.PDF" )
>>>>oParameter.attachment(2) = "DOC2.PDF"
>>>>
>>>>
>>>>Then to get the value from the oParameter, I would have to use:
>>>>
>>>>cValue1 = oParameter.attachment[1]
>>>>cValue2 = oParameter.attachment[2]
>>>>
>>>>
>>>>But I would need to know the number of elements in the array. Is passing the number of elements as another parameter the only way?
>>>
>>>Use a loop to process the array?
>>>
>>>Tamar
>>
>>Yes, with ALEN() as Greg Green suggested, I can loop.
>
>Yeah, I started to write that you should use ALEN(), but realized that wasn't sufficient, so mentioned the loop. Didn't occur to me that you didn't know you could use ALEN() on a property array. Most of VFP's A... functions work on property arrays. When they don't, you can use ACOPY() to move the array to a regular variable.
>
>Tamar

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform