POM Queries in Teamcenter

 

 

 

 

 

 

 

 

 

 

 

 

POM Queries in Teamcenter

POM(Persist Object Manager) is one of the most important Teamcenter ITK modules used for data extraction. It facilitates the interaction to Teamcenter database through ITK APIs rather than using SQL commands.

Characteristic of POM Query.

  • It has a unique identification called as Query ID.
  • It has Select statement/command from POM Classes.
  • It has an expression to specify where conditions.
  • Multiple Expressions are combined through POM APIs.
  • It has to be executed to get the output.

Steps to create a basic POM Query:

Step 1: Create a Query using Query ID

POM_enquiry_create(arguments)–>It creates a unique identification of the query which is recognized by Teamcenter server.


Creation of DLL in ITK


Step 2: Select Attributes

POM_enquiry_add_select_attrs(arguments)–> It sets the number of attributes to be fetched.

Step 3: Build Expression

POM_enquiry_set_attr_expr(arguments)–> It sets the expression name.

POM_enquiry_set_string_value(arguments)–> It binds the input value to data types. Int, Double, Char, String, Logical, Date, Tag are valid data types supported by POM APIs.

Step 4: Expression Binding

POM_enquiry_set_expr(arguments)–> It binds multiple expressions logically using and clause.


                      Teamcenter Workflow Handlers


Step 5: Query Execution

POM_enquiry_execute()–> It executes the query on server and fetches the results and stores in array. Output Array data needs to be extracted and type casted for specific type based on select attributes provided for POM Query.

Below is a simple POM Query to extract Item id

/*********Sample POM pseudo code**************/

const char * Output_Attr_List[] = {“Item_ID”};

const char * ItemID[] = {“Test_Item”};

const char * ItemType[] = {“Item”};

POM_enquiry_create (“Query_ID”);

POM_enquiry_add_select_attrs(“Query_ID”, “Item”,1,” Output_Attr_List);

POM_enquiry_set_attr_expr(“Query_ID”, “Expression1”, “Item”, “item_id”, POM_enquiry_equal,“OutputValId1”);

POM_enquiry_set_string_value (“Query_ID”, ” OutputValId1″, 1, ItemID, POM_enquiry_bind_value);

POM_enquiry_set_attr_expr(“Query_ID”, ” Expression2″, “Item”, “object_type”, POM_enquiry_equal, “OutputValId2”);

POM_enquiry_set_string_value (“Query_ID”, ” OutputValId2″, 1, ItemType, POM_enquiry_bind_value);

POM_enquiry_set_expr(“Query_ID”, ” Expression3″, ” Expression1″, POM_enquiry_and, ” Expression2″);

POM_enquiry_execute(“Query_ID”, &nRows,&nCols,&results);

/*************End*************/

 

We will more post on PLM TUTORIAL–>Teamcenter Customization in upcoming days.

Kindly provide your valuable comment on below Comment section and also have you any question kindly ask to ASK QUESTION in FORUM. Our Team will try to provide the best workaround.

Kindly subscribe your Email-Id at (http://globalplm.com/) and drop any suggestion/queries to (globalplm2@gmail.com).

 

Leave a Reply

Your email address will not be published. Required fields are marked *