More information about the Underscore mailing list

[_] Calling PHP Heads...

Adam Nicholls inkysplat at gmail.com
Fri Jul 12 10:42:07 BST 2013

Normally I can call the Fields method to get data out so:

echo $Record->Fields('FIELD_NAME');

So my assumption is that PHP considers Fields() a method rather than a
property which makes it difficult.


-------------------------------------------------------------------------------------------


class _CConstitAddress { /* GUID={9D8694AE-4B9B-11D4-80B5-00B0D0119B1C} */
        /* DISPID=1610612736 */
        function QueryInterface(
                /* VT_PTR [26] [in] --> ? [29]  */ &$riid,
                /* VT_PTR [26] [out] --> VT_PTR [26]  */ &$ppvObj
                )
        {
        }
        /* DISPID=1610612737 */
        /* VT_UI4 [19] */
        function AddRef(
                )
        {
        }
        /* DISPID=1610612738 */
        /* VT_UI4 [19] */
        function Release(
                )
        {
        }
        /* DISPID=1610678272 */
        function GetTypeInfoCount(
                /* VT_PTR [26] [out] --> VT_UINT [23]  */ &$pctinfo
                )
        {
        }
        /* DISPID=1610678273 */
        function GetTypeInfo(
                /* VT_UINT [23] [in] */ $itinfo,
                /* VT_UI4 [19] [in] */ $lcid,
                /* VT_PTR [26] [out] --> VT_PTR [26]  */ &$pptinfo
                )
        {
        }
        /* DISPID=1610678274 */
        function GetIDsOfNames(
                /* VT_PTR [26] [in] --> ? [29]  */ &$riid,
                /* VT_PTR [26] [in] --> VT_PTR [26]  */ &$rgszNames,
                /* VT_UINT [23] [in] */ $cNames,
                /* VT_UI4 [19] [in] */ $lcid,
                /* VT_PTR [26] [out] --> VT_I4 [3]  */ &$rgdispid
                )
        {
        }
        /* DISPID=1610678275 */
        function Invoke(
                /* VT_I4 [3] [in] */ $dispidMember,
                /* VT_PTR [26] [in] --> ? [29]  */ &$riid,
                /* VT_UI4 [19] [in] */ $lcid,
                /* VT_UI2 [18] [in] */ $wFlags,
                /* VT_PTR [26] [in] --> ? [29]  */ &$pdispparams,
                /* VT_PTR [26] [out] --> VT_VARIANT [12]  */ &$pvarResult,
                /* VT_PTR [26] [out] --> ? [29]  */ &$pexcepinfo,
                /* VT_PTR [26] [out] --> VT_UINT [23]  */ &$puArgErr
                )
        {
        }
        /* DISPID=1610809444 */
        function ParseAddress(
                )
        {
                /* Deprecated */
        }
        /* DISPID=1745027118 */
        /* VT_PTR [26] */
        /* Get the attributes associated with this address. */
        var $Attributes;

        /* DISPID=1745027117 */
        /* VT_PTR [26] */
        /* Get the address links associated with this address. */
        var $Links;

        /* DISPID=1745027116 */
        /* VT_PTR [26] */
        /* Get the phones and email addresses associated with this address. */
        var $Phones;

        /* DISPID=1745027109 */
        /* VT_VARIANT [12] */
        /* Set or get the contents of the specified field. */
        var $Fields;

        /* DISPID=1745027109 */
        /* Set or get the contents of the specified field. */
        var $Fields;

        /* DISPID=1610809415 */
        function Validate(
                )
        {
                /* Validate the contents of this object. */
        }
        /* DISPID=1745027074 */
        /* VT_PTR [26] */
        /* Get the individual contact associated with this address (only valid w
hen in address processing mode). */
        var $Contact;

}

On 12 July 2013 10:34, Martin Wheatley <martin at spodnet.net> wrote:
> Difficult to test without access...
>
> Can you com_print_typeinfo the Bank object, if might indicate some more info
>
>
> On 12/07/2013 10:28, Adam Nicholls wrote:
>>
>> Sorry yep forgot to add I've already tried that too.
>>
>> The API claims the property doesn't exist says it's 'unable to look up...'
>>
>> On 12 July 2013 10:23, Martin Wheatley <martin at spodnet.net> wrote:
>>>
>>> On 12/07/2013 10:17, Adam Nicholls wrote:
>>>>
>>>>
>>>> Hi Guys/Gals,
>>>>
>>>> I'm doing some integration work with a COM API and according to their
>>>> documentation to save data in the API, you have to assign to the
>>>> method.
>>>>
>>>> This is their example in Visual Basic (VBA?)
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------------------------------------
>>>>       Set oBank = New Bank
>>>>       oBank.Init Application.SessionContext
>>>>       With oBank
>>>>           .Fields(BANK_fld_ACCOUNT_NAME) = "Test account"
>>>>           .Fields(BANK_fld_ACCOUNT_NO) = "12345"
>>>>           .Fields(BANK_fld_BANK) = "Bank of the Nation"
>>>>           .Fields(BANK_fld_BRANCH_NAME) = "State Street Branch"
>>>>       End With
>>>>       oBank.Save
>>>>
>>>>
>>>> -------------------------------------------------------------------------------------
>>>>
>>>> Obviously in PHP is isn't possible to assign to a method in this way
>>>> (thats what parameters are for!) So I'm at a bit of a loose end. I'm
>>>> wondering if anyone else has come across this? Or am I missing
>>>> something obvious in PHP's implementation of the COM that allows me to
>>>> work around this?
>>>>
>>>> My PHP Code is looks like this:
>>>>
>>>>
>>>> -------------------------------------------------------------------------------------
>>>> $API = new COM('API');
>>>> $API->Init($SerialNo, $Login, '', 1, '', 1);
>>>> $API->SignOutOnTerminate = True;
>>>>
>>>> $Record = new COM("Data.Bank");
>>>> $Record->Init($API->SessionContext);
>>>>
>>>> $Record->Fields('ACCOUNT_NAME') = 'Test Account';//doesn't work
>>>>
>>>>
>>>> -------------------------------------------------------------------------------------
>>>>
>>>> I've also tried (below) but the API says wrong number of parameters
>>>>
>>>> $Record->Fields('ACCOUNT_NAME', 'Test Account');
>>>>
>>>> I've also tried something crazy like this (below) but that overwrites
>>>> the $Record object and means I can't call the Save() method.
>>>>
>>>> $_R = &$Record->Fields('ACCOUNT_NAME');
>>>> $_R = 'Test Account';
>>>>
>>>>
>>>> Any ideas? Is it possible? I'm able to read data through the API so I
>>>> know it's working I just can figure out how to do the assignment.
>>>>
>>>>
>>>> Many Thanks
>>>> Ads.
>>>>
>>>
>>>
>>> Have you tried
>>>
>>> $Record->Field->ACCOUNT_NAME = 'Test Account';
>>>
>>>
>>>
>>> --
>>> underscore_ list info/archive ->
>>> http://www.under-score.org.uk/mailman/listinfo/underscore
>>
>>
>>
>>
>
>
> --
> underscore_ list info/archive ->
> http://www.under-score.org.uk/mailman/listinfo/underscore



-- 
Adam Nicholls