Skip to Content
author's profile photo Former Member
Former Member

How to access SBO objects within UDO-DLL

Hi,

I have a problem of accessing the SBO objects within the UDO-DLL (in C++).

Here is the scenario. I created a UDO (CIM_MWO), which represents MyWorkOrder. Whenever a new MyWorkOrder is to add to the system, I need to check the item availability. Here is the pseudo code.

SBOErr CIM_MWO::OnAdd()

{

// From this instance of MyWorkOrder

// 1. Gets item no.

wchar_t* itemNo;

long len = GetValueLength(...);

...

GetValue( itemNo );

...

// 2. Gets qty required

// ...

// HERE I need the QuantityOnStock

// and other info of the specified item.

// HOW can I get it???

// ...

// if enough qty available

// return CSboBusinessObject::OnAdd();

// else

// return E_NO_ENOUGH_STOCK;

}

Option 1:

I can get the item like this:

CSboBusinessObject* item =

CreateBusinessObject( "4" );

item->GetByKey( itemNo );

...

BUT I don't know the field alias for property "QuantityOnStock" if calling GetValue(...)

Option 2:

Using the DI API, like this:

IUnknown* item = pDICompany->GetBusinessObject( "4" );

item->GetByKey( itemNo );

...

BUT there is problem of getting the **pDICompany**

Is there anyone can offer some clue on this? Thanks.

John

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Feb 02, 2005 at 12:38 PM

    Hi,

    You must use the class CSBODataAccessGate to obtain a representation of the table representing your UDO.

    CSboDataAccessGate dagMOR1 = GetDAG (ArrayOffset);

    Then you work with your CSboDataAccessGate to obtain all information about your UDO table (you can for example use the function DoQuery to obtain a list of records with a special characteristic).

    You have a sample into the UDO samples, it is called MealOrder/DllImplement.

    You have also a special UDO Help file, you can have a look at the different objects and functions to implement a dll.

    Hope it helps

    Trinidad.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Maria Trinidad MARTINEZ GEA

      Hi Trinidad,

      Thanks very much for your help. I think I got at least a workable solution, though it's not perfect. To map the wanted properties described in DI API to table fields is a sort of tedious task.

      Actually, I tried a quite number of hours to work out a solution based on the option 2 in my original post. But not succeeded yet 😔

      I have a SBO add-on EXE (VB.NET), a UDO DLL (VC+) for MyWorkOrder. I tried to expose a COM (which contains DI Company reference) in the EXE, but failed because of the .NET restriction, or my mistake (not sure yet). I even tried to create a DCOM exe (VC+) as a pipe to transfer the DI company reference from add-on exe to UDO DLL, but failed and every time I got different error message ("invalid memory access", "Object is not connected to server", or "invalid cast"). However, I succeeded in transfering a integer from add-on exe to UDO DLL via such pipe.

      I hope what I described here can be helpful for those who are working or will work on a similar scenario. Also, If someone can offer any solution on the issues mentioned above, I'll appreciate it very much. Thanks.

      John

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.