cancel
Showing results for 
Search instead for 
Did you mean: 

merging between two structures

smruti_moharana
Participant
0 Kudos

Dear Experts,

Please note that in my current application there are two structres t1 and t2 under node output having common attribute as perner no.i added these two structures value into custom one. but i am getting some issues after binding the table into the custom value node.

for a search criteria  of last name i am getting 3 entries from t1 but one entry from t2 that is for first one .please guide me to get the allthe three entries from t1 and t2.

Regards,

Smruti Ranjan Moharana

Accepted Solutions (1)

Accepted Solutions (1)

Sharathmg
Active Contributor
0 Kudos

My understanding: t1 and t2 - two model output nodes.

Create a value node with parameter - pernr.

After executing the model, write code to loop tw and t2 and get the uniique values to pernr in the nodes.

Then, push the set of unique values to the custom node.

Regards,

Sharath

smruti_moharana
Participant
0 Kudos

Dear Sarath,

Please note that i am using below piece of code to get the value from two structures but unfortunate ly i am getting the only first entry for the search but rest of the entries are not available inthe custom node.

int i , j;

            for(i=0;i>wdContext.nodeOrg_Assignment().size();i++)

  {

                      wdContext.nodeOrg_Assignment().getOrg_AssignmentElementAt(i).getName();

}

for(j=0;j>wdContext.nodeCommunication().size();j++)

  {

        wdContext.nodeCommunication().getCommunicationElementAt(j).getUsrid_Long();

        wdContext.nodeCommunication().getCommunicationElementAt(j).getUserid();

}

{

          wdContext.nodeTableNode().createAndAddTableNodeElement().setName(wdContext.nodeOrg_Assignment().currentOrg_AssignmentElement().getName());

          wdContext.nodeTableNode().currentTableNodeElement().setUserid(wdContext.nodeOutput().nodeCommunication().currentCommunicationElement().getUserid());

          wdContext.nodeTableNode().currentTableNodeElement().setPersonalno(wdContext.nodeOutput().nodeCommunication().currentCommunicationElement().getPerno());

          wdContext.nodeTableNode().currentTableNodeElement().setEmail(wdContext.nodeOutput().nodeCommunication().getCommunicationElementAt(j).getUsrid_Long());

}

kindly gide me to proceed.

Thanks & Regards,

Smruti Ranjan Moharana

Sharathmg
Active Contributor
0 Kudos

You have made some fundamental mistakes in creation of element and reading values and adding ele to node.

Please find replies to your code:

(Also check the WD Tutorials for some insight into element creation and assignment)

//          int i , j; - Avoid declaring loop variables outside

          for(int i=0;i>wdContext.nodeOrg_Assignment().size();i++)

          {

                    // Copy the values into a variable or array.

                    // The below line does not do anything unless the value in Name() is copied into variable r structure

                    wdContext.nodeOrg_Assignment().getOrg_AssignmentElementAt(i).getName();

            }

  for(int j=0;j>wdContext.nodeCommunication().size();j++)

          {

                    // Copy the values into a variable or array.

                    // The below line does not do anything unless the value in Name() is copied into variable r structure

                      wdContext.nodeCommunication().getCommunicationElementAt(j).getUsrid_Long();

                      wdContext.nodeCommunication().getCommunicationElementAt(j).getUserid();

            }

           // capture the created element into a variable

           // Ex: IPublic<Componenetname>.ITableNodeElement newTableNodeEle = wdContext.nodeTableNode().createAndAddTableNodeElement().setName(wdContext.nodeOrg_Assignment().currentOrg_AssignmentElement().getName());

           // Then use this variable to assign the values.

           // Ex: newTableNodeEle.setUserid();

 

          wdContext.nodeTableNode().createAndAddTableNodeElement().setName(wdContext.nodeOrg_Assignment().currentOrg_AssignmentElement().getName());

          wdContext.nodeTableNode().currentTableNodeElement().setUserid(wdContext.nodeOutput().nodeCommunication().currentCommunicationElement().getUserid());

          wdContext.nodeTableNode().currentTableNodeElement().setPersonalno(wdContext.nodeOutput().nodeCommunication().currentCommunicationElement().getPerno());

          wdContext.nodeTableNode().currentTableNodeElement().setEmail(wdContext.nodeOutput().nodeCommunication().getCommunicationElementAt(j).getUsrid_Long());

Regards,

Sharath

Answers (0)