PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → associative array & procedures
associative array & procedures
Débuté par Scott, 03 juil. 2008 09:49 - 1 réponse
Posté le 03 juillet 2008 - 09:49
Hello all,
I am running into an issue when trying to pass an associative array to a procedure or return an associative array from a procedure. I am hoping somebody could please shed some light on the issue… I am sure it is something simple 
Example:
this_data is associative array of strings
this_data["Name"]="Scott"
this_data["Email"]="scott@example.com"
arrayProc(this_data)
PROCEDURE arrayProc(LOCAL this_array)
Trace("Name", this_array["Name"])
Trace("Email", this_array["Email"])
Note: I also tried (LOCAL this_array is associative array of strings) and no luck.
This produces the error “Unable to convert element from associative array type to associative array type.” Also If I try it in reverse (procedure creates an array and returns the value) I get the same error.
Thank you in advance for any help you can offer.
Thanks,
Scott
Posté le 03 juillet 2008 - 09:49
I found the issue...
procedure(LOCAL this_array)
WD doesn't allow you to use LOCAL with an array.
"An array type variable or an object (class instance) cannot become local to a procedure."
I guess i needed a little more RTFM :-)
Thanks,
Scott