Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange TYPE() Value of Z ???
Message
De
08/05/2009 09:34:30
 
 
À
08/05/2009 00:26:13
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01398466
Message ID:
01398595
Vues:
76
That works! Thanks Agnes. Rick S gave me the same advice. It makes for a lot of code (I have to traverse a lot of collections and arrays in one object), but it gets the job done. :o)


>Hi Tracy,
>
>sometimes VFP seems to have problems such collections.
>
>If I run into a problem like this I try to decompose the object to a closer var like
>
>loTemp = arg.callscript.scriptmodules.item(0)
>loTemp = loTemp.questions.item[0]
>loTemp = loTemp.answers[0]
>?lotemp
>
>
>Note that it needs each step
>
>HTH
>Agnes
>>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"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform