Forum Discussion

vishwas_n's avatar
vishwas_n
Occasional Contributor
12 years ago

Fetching data from Array

Unable to fetch data from an array element ...



Please check the attachment.

It is throwing back nothing. If I use " Log["Message"](a[0]) "



C#Scripting ... Please helpout.

1 Reply

  • vishwas_n's avatar
    vishwas_n
    Occasional Contributor
    The array returned by the WMI query is in the safe array format. Since JScript, C++Script and C#Script arrays aren't compatible with this format, one needs to convert array to the native format using the toArray method of the VBArray object.



    The corrected code snippet below:

     

    [C#Script]

    var a = WmiQuery(".","","","Testing10");

    convertedArray = (new VBArray(a))["toArray"]();



    - Via QA Team SmartBear