Plex 2E

  • 1.  Array to API Source Code

    Posted Dec 02, 2009 09:36 PM
    Hello,  can i define a input parameter for a source code as an array? or is it only possible to define a single field?  my c++ source code   works with sap-tables (arrays) and i want to fill them via plex input parameters.    thanks.  tobias h.  


  • 2.  Re: Array to API Source Code

    Posted Mar 16, 2017 05:01 PM

    has anyone an idea...?



  • 3.  Re: Array to API Source Code

    Posted Mar 23, 2017 10:40 AM

    Normally when I do something like this I have source code for one element of the array, and call it in an action diagram loop.

     

    Testing this it appears as if the parameter mapped to source code is the array item, not the array.  You could put the source code in an action diagram loop, or you could generate your source code, look up the generated field names, and write source code that is very specific to the action diagram.  This source code would break if any extra fields were added.

     

    Source code created (parameter is request ID from FetchedData):

    {
       CString Message = &(1:);
    }

     

    Generated code:

    ObUserAPI::PrepareAPICall(p_fnc_data);
    {
       CString Message = v->ObOut_CO432F.FetchedData11[m->FetchedData11].Request_Id_22;
    }

     

    Possible (fragile and very brittle) source code:  This would fail any time you added a new field or variable to the function.

     

    {

       for (int i = 0 ; i < 64; i++){

          CString Message = v->ObOut_CO432F.FetchedData11[i].Request_Id_22;

       }

    }

     

    If you are using .NET, you might be able to use the SYMBOLIC_NAME operator with some reflection to dynamically determine the array and iterate over it.