REALbasic array in an array

572 views Asked by At

I am trying to write a soap parameter in REALbasic.

I need to add an array within another array similar to this in php:

 $params = array(array(
     'sku' => 'some sku'
 ));

so I can pass this:

$result = $client->call($session, 'catalog_product.list', $params);

I have

  dim aArgs  (0,1) as String
  dim aParmas  (0,1) as String
  aArgs(0,0)="sku"
  aArgs(0,1)="some sku"
  aParmas(0,1)= aArgs

But receive a "Type mismatch error. Expected String, but got String(,)"

How can I do this.

Thanks

2

There are 2 answers

3
hammus On

An explanation of multidimensional arrays in REALbasic is here

The short answer is that you can't have a PHP-like array of arrays. You need to wrap your array in a class and make the class behave like an array.

Any reason you're using REALbasic? If it's cross-platform you're after, python is ALWAYS a better choice

0
Thomas Tempelmann On

First off, the line

aParmas(0,1)= aArgs

is wrong because you assign an array (which is in aArgs) to a single element of aParmas. And since those single elements hold a String, you try to assign an array to a single string here, hence the error message.

But I think you're looking at this from the wrong end. You need to start with figuring out what parameters you need to send to the session function you want to call.

That means: You need to find the REALbasic function for $client->call. Once you know which function that is, look at the parameters that function expects. I doubt it expects a two-dimensional array for the "params". Once you know what to pass here, let us know if you still cannot figure out how to get it working.