Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange TYPE() Value of Z ???
Message
From
07/05/2009 17:50:26
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Strange TYPE() Value of Z ???
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01398466
Message ID:
01398466
Views:
149
I have an array as a property of an object. The object is passed from a COM dll. I create an object to hold the passed object using:

PUBLIC loQuestion AS comdll.TRQuestionClass

now loQuestion has two properties:

1) Question - type = 'C', value = 'Question 1'
2) Answers - type = 'Z', value = 'Array'

What is a type of 'Z' ? that shows in VFP in the debugger.

The passed object is an arg of variant type. One of it's properties is a collection that contains a string and an array in each item. The questions collection property in the passed arg matches the loQuestion object I created. So it should be the same (2 properties that match my loQuestion object) and it does. It has:

arg.callscript.scriptmodules.item(0).questions.item[0]

Now that object (questions.item[0] in the scriptmodules collection) returns:
TYPE("arg.callscript.scriptmodules.item(0).questions.item[0]") = "O"  && <-- correct
The above is a single question object in the questions collection with an array of matching answers that matches my loQuestion object.
There should be:
arg.callscript.scriptmodules.item(0).questions.item[0].question  && character
arg.callscript.scriptmodules.item[0].questions.item[0].answers  && array
The answers array exists because:
TYPE("arg.callscript.scriptmodules.item(0).questions.item[0].answers") = "A"  && correct, answers is the array I need
ALEN(arg.callscript.scriptmodules.item(0).questions.item[0].answers,1) = 1    && correct there is one element in the array
However, if I try to copy the array over to loquestion.answers, it bombs:
=ACOPY(arg.callscript.scriptmodules.item(0).questions.item[0].answers,loQuestion.Answers) && bombs with 'Feature is not available' msg
and:
FOR it = 1 TO ALEN(arg.callscript.scriptmodules.item(0).questions.item[0].answers,1) -1
  ? it            && prints 0 which is correct - one element in the array
ENDFOR
However,
FOR it = 1 TO ALEN(arg.callscript.scriptmodules.item(0).questions.item[0].answers,1) -1
  ? arg.callscript.scriptmodules.item(0).questions.item[0].answers[it]   && BOMBS!   Returns OLE Error: 'Invalid number of parameters'
ENDFOR
So I cannot step throught the elements to copy it to the loQuestion.Answers array either.

Same error if I just:
 ? arg.callscript.scriptmodules.item(0).questions.item[0].answers[0]   && BOMBS!   Returns OLE Error: 'Invalid number of parameters'
I know it's an array, but passed property seems to be an array I cannot access the elements of and in vfp the object type I create to hold it it is of type 'Z' with a value of 'Array'

In the .net dll it's defined as:

TRQuestionClass

public string[] Answers {get;set;}
public string Question {get;set;]


How do I work with that? I don't understand why the array can't be accessed.

I am working with lots of passed objects in other events and collections and strings all work fine, but arrays seem to be a problem for some reason.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform