Plex 2E

 View Only
  • 1.  Calling a BlockFetch via COM from C#

    Posted Feb 11, 2019 08:31 AM

    Hello,

     

    recently I created a COM Package to call WinC functions via COM from C#.
    I am trying to call a BlockFetch function in a managable way. For testing i am using the "Dot NET Connector" sample model.
    The output fields are located by the default variable "FetchedData" while using the "occurs" mechanic.

     

    Now to the problem:
    All output fields are exposed as single call-by-reference values. When using a view of multiple fields while occuring 64 times the parameter list gets quickly out of hand.

    BlockFetch:
        Output
            FetchedData [5]
                DiscountClassCode
                DiscountClassDescription
                DiscountClassPercentage

     

    Created function:
    void BlockFetch(string bstrPositionDiscountClassCode, string bstrControlPosition, int longControlRowsFetched,
     ref string bstrFetchedData1DiscountClassCode, ref string bstrFetchedData1DiscountClassDescription, ref double doubleFetchedData1DiscountClassPercentage,
     ref string bstrFetchedData2DiscountClassCode, ref string bstrFetchedData2DiscountClassDescription, ref double doubleFetchedData2DiscountClassPercentage,
     ref string bstrFetchedData3DiscountClassCode, ref string bstrFetchedData3DiscountClassDescription, ref double doubleFetchedData3DiscountClassPercentage,
     ref string bstrFetchedData4DiscountClassCode, ref string bstrFetchedData4DiscountClassDescription, ref double doubleFetchedData4DiscountClassPercentage,
     ref string bstrFetchedData5DiscountClassCode, ref string bstrFetchedData5DiscountClassDescription, ref double doubleFetchedData5DiscountClassPercentage);

     

    -> Is it possible to expose the values as arrays? Other idears?
     
     Thanks in advance!



  • 2.  Re: Calling a BlockFetch via COM from C#

    Posted Mar 28, 2019 11:02 PM

    G'day Cherzog (?),

     

    An approach I would use is to encapsulate the BlockFetch with another function that has one VaryCharacter field as output and in that other function I would combine all the output fields from the BlockFetch into that single field using some form of fixed structure that your calling C# module could de-construct back into an the correct elements.

     

    I suppose you could use a bit of Source to build a structure that C# can easily convert as well.

     

    You can override the CA Plex pattern that implements BlockFetch to include the new function and write Meta code to parse the output variables and construct the new VaryCharacter field that will be used by C# module.That will reduce the effort required to implement the solution significantly.

     

    Regards,

     

    Darryl