Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADDPROPERTY array
Message
From
23/04/2021 20:05:15
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01679967
Message ID:
01679985
Views:
39
>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?

Hello Dmitry:

You can use e() function from nfTools to greatly simplify the
parameter object creation, like this:
* using nfTools:

oParameter = e('attachment(2)',m.doc1,m.doc2,'count',2)

* instead of :

oParameter = create('empty')
addProperty(oParameter,'attachment(2)')
oParameter.attachment(1) = m.doc1
oParameter.attachment(2) = m.doc2
addProperty(oParameter,'count',2)
Check nfTools e() full syntax & capabilities at: https://www.github.com/nftools/e

download: https://github.com/nftools/e/archive/refs/heads/main.zip
@nfoxdev
github.com/nfoxdev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform