Extra array in multi-occurrence return values

Extra array in multi-occurrence return values

Postby timo_karvinen on Thu Jan 24, 2013 10:35 am

There seems to be an "extra" array in multi-occurrence DS's returned with newest version of the toolkit (1.4.0).

Here's a dump:
Code: Select all
     '_outputVarsToExport' =>
    array (
      'Pb_Code' => '0',
      'Po_ErrNbr' => '0',
      'PO_Err' =>
***************** THIS ONE:
      array (
        0 =>
*****************
        array (
          0 =>
          array (
            'Err_Id' => '',
            'Err_Msg' => '',
            'Err_Field' => '',
            'Err_Sev' => '0',
          ),
          1 =>
          array (
            'Err_Id' => '',
            'Err_Msg' => '',
            'Err_Field' => '',
            'Err_Sev' => '0',
          ),
          2 =>
          array (
            'Err_Id' => '',
            'Err_Msg' => '',
            'Err_Field' => '',
            'Err_Sev' => '0',
          )...


The variable "PO_Err" here should contain 10 arrays, now it only contains one array that has the 10 arrays inside it.
So the extra array should be removed in my opinion.

Here's how the DS was defined:
Code: Select all
    array (
      'DSName' => 'PO_Err',
      'io' => 2,
      'count' => 10,
      'DSParm' =>
      array (
        0 =>
        array (
          'name' => 'Err_Id',
          'io' => 2,
          'type' => 0,
          'length' => '7',
        ),
        1 =>
        array (
          'name' => 'Err_Msg',
          'io' => 2,
          'type' => 0,
          'length' => '132',
        ),
        2 =>
        array (
          'name' => 'Err_Field',
          'io' => 2,
          'type' => 0,
          'length' => '30',
        ),
        3 =>
        array (
          'name' => 'Err_Sev',
          'io' => 2,
          'type' => 7,
          'length' => '1.0',
        ),
      ),
    )

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Extra array in multi-occurrence return values

Postby timo_karvinen on Thu Jan 24, 2013 10:59 am

Might be related to this, debug log shows following 2 rows:
Code: Select all
<ds var='PO_Err' array='on'>
<ds var='PO_Err' comment='Multi-occur container' array='on'>


Most likely only one of those rows should be there.

Also wondering if this is the intended behavior, the log follows with:
Code: Select all
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>
<ds dim='10'>
<data var='Err_Id' type='7a' ><![CDATA[]]></data>
<data var='Err_Msg' type='132a' ><![CDATA[]]></data>
<data var='Err_Field' type='30a' ><![CDATA[]]></data>
<data var='Err_Sev' type='1s0' ><![CDATA[0]]></data>
</ds>


All those are empty occurrences, is it really necessary to have that much XML for empty arrays?

Or is there something wrong with my configuration or something? I have set the following in toolkit.ini:
Code: Select all
dataStructureIntegrity = true
arrayIntegrity = true

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Extra array in multi-occurrence return values

Postby aseiden on Wed Feb 13, 2013 8:47 am

Hi, Timo,

I'll check it out. I think this is a CW example.

About the "ds dim='10'>" repeated XML, is this Input or Output? I am guessing it's output. Please confirm that for me.

Thanks--
Alan
aseiden
 
Posts: 834
Joined: Thu Apr 09, 2009 5:45 pm

Re: Extra array in multi-occurrence return values

Postby timo_karvinen on Wed Feb 13, 2013 10:32 am

Hi Alan.

Yes, CW is being used for these calls.

And yes, this is output (I'm pretty sure, been a while) from toolkit.

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Extra array in multi-occurrence return values

Postby aseiden on Tue Mar 19, 2013 4:50 pm

Hi, Timo,

I believe you but I haven't been able to duplicate the issue.

Could you send me the PHP code you used? (Post here or email to alan@alanseiden.com).

Thank you!
Alan
aseiden
 
Posts: 834
Joined: Thu Apr 09, 2009 5:45 pm

Re: Extra array in multi-occurrence return values

Postby timo_karvinen on Thu Mar 21, 2013 4:03 pm

Hi Alan.

Unfortunately I still don't have a sample code to post (because our real scripts are thousands and thousands of lines and go through like tens of classes etc.), but I looked into this a bit more.

It seems to boil down to input parameters given to program call, if I give the program call input params with DS input as "null" then we get the "extra array in output" situation. This is I/O "BOTH" DS by the way.
Code: Select all
array (
  'Pb_Code' => '',
  'Pb_Caller' => '',
  'Pb_Pyks' => '',
  'Pb_User' => '',
  'Pb_ErrNbr' => 0,
  'PO_Err' => NULL,
  'Pb_Hakty' => '',
)


It seems I can fix the situation by defining "empty" input array with all the keys inside it like so:
Code: Select all
array (
  'Pb_Code' => '',
  'Pb_Caller' => '',
  'Pb_Pyks' => '',
  'Pb_User' => '',
  'Pb_ErrNbr' => 0,
  'Pb_Err' =>
  array (
    0 =>
    array (
      'Err_Id' => '',
      'Err_Msg' => '',
      'Err_Field' => '',
      'Err_Sev' => 0,
    ),
  ),
  'Pb_Hakty' => '',
)

Called with these input params the output is void of the extra array and all is fine, but it'd be nice if null/other empty values worked too.

Also it seems if I give empty array like 'PO_Err' => array() this breaks the toolkit/cw, I'd be nice if that notation would work also.

See if you can reproduce this situation with these directions.

Thanks.
-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Extra array in multi-occurrence return values

Postby aseiden on Thu Mar 21, 2013 7:46 pm

Timo, thanks for the research. The CW expects "empty" values (blank or zero) in that situation, so I tested it that way. I could consider adding null as well.

Alan
aseiden
 
Posts: 834
Joined: Thu Apr 09, 2009 5:45 pm

Re: Extra array in multi-occurrence return values

Postby timo_karvinen on Fri Mar 22, 2013 10:08 am

Also, and maybe more importantly, if I have that Error DS defined as output only, the same thing happens.
Because output only DS doesn't get added to the input parameters, it's effectively "null" and again we are in situation when we get the pesky extra array from output DS.

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland

Re: Extra array in multi-occurrence return values

Postby timo_karvinen on Tue Feb 18, 2014 12:59 pm

Hi, I've been very busy with other projects so haven't had change to work with the new toolkit lately.

Now I found some time to look at it and I was bit surprised to see that this same "problem" / "missing feature" still exists in the most current version of the toolkit.
Any chance the null situation could be worked out in cw?

-Timo
timo_karvinen
 
Posts: 74
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland


Return to New Toolkit

Who is online

Users browsing this forum: No registered users and 1 guest