Passing array parameters to the com Method

Source: Internet
Author: User
A customer's sales order and purchase order require workflow review to deliver or receive goods. It requires integration with the workflow of the OA system, starts the process in axapta, and signs the signature in the workflow, after the signature is completed, write back the information of the corresponding axapta document.
Today, I got it. Because OA is written in VB + ASP, we need to call com when starting the process. axapta provides the com class to call COM, it is easy to implement, but it is difficult to pass array parameters.
The START process provided by the workflow COM is received in the form of a string array. Code Call: Com workflow;
Str
100 Dataarray [ 1 ];
;

Dataarray [
0 ] =   " Orderno = flowtest " ;
Workflow
=   New COM ( " Workflow " );
Workflow. startprocess (dataarray );

It tells me: COM (object), method called startprocess with invalid parameter.
Later I thought about it. The array of axapta is also weird. It is definitely not the same as the array of VB. Then I can see that there is a comvariant that can be used, run an Array Using comvariant. the Code is as follows:Array arr =   New Array (types: Class );
Comvariant comvar;
;
Comvar
=   New Comvariant ();
Comvar. BSTR (strfmt (
" Packno = flowtest " );
Arr. Value (
1 , Comvar );

Comvar
=   New Comvariant ();
Comvar. safearray (ARR, comvarianttype: vt_variant );

Then pass the obtained comvar as the parameter and it will be OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.