cancel
Showing results for 
Search instead for 
Did you mean: 

Very Easy Question - How to show only selected rows in table

Former Member
0 Kudos

Hi Experts,

I have created WD Project which calls a RFC. The RFC returns no of records of 100 countries. I want to show only those records to the end user for which Country_Code is India and USA.

How I can do so?

Regards,

Gary

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

For example your model node is CountryModelNode and the value node binded to table is CountryValueNode then:

int sizeCountryModelNode=wdContext.nodeCountryModelNode().size();

for(int iCount=0;iCount<sizeCountryModelNode;iCount++)
{
   if("IN".equalsIgnorecase(wdContext.nodeCountryModelNode().getCountryModelNodeElementAt(iCount).getCountryCode())
   || "US".equalsIgnorecase(wdContext.nodeCountryModelNode().getCountryModelNodeElementAt(iCount).getCountryCode()))
   {
    IPrivateCountryValueNode.ICountryValueNodeElement element=wdContext.createCountryValueNodeElement();
    element.setCountryCode(wdContext.nodeCountryModelNode().getCountryModelNodeElementAt(iCount).getCountryCode());
    element.setCountryName(wdContext.nodeCountryModelNode().getCountryModelNodeElementAt(iCount).getCountryName());
   wdContext.nodeCountryValueNode().addElement(element); 
 }
}

Note: Bind CountryValueNode to the table:

Regards,

Charan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Its simple. while reading the output from the RFC, check in loop if the country code is India or USA, if so then add those values to the Table node, else skip it.

Hope this helps.

Thanks and Regards,

Vivek.

Former Member
0 Kudos

Hi,

Can you please provide me some sample code.

Regards,

Gary

Former Member
0 Kudos

Hi,

After the model execution,

try to get the value of the country code

IPrivateView.I<RFC node> rfcn = wdcontext.node<RFC node>

IPrivateView.I<Table node> tn = wdcontext.node<Table node>

for(int i = 0;i<rfcn.size();i++

{

IPrivateView.I<Rfc element> rfce = rfcn.getRFCElementat(i);

if(rfce.<countrycode>.equalsignorecase(<India or USA>))

{

IPrivateView.I<Table table> tne = wdcontext.create<table Element>;

tne.setcountrycode(rfce.get<countrycode);

// add rest of the table fields like this..

tn.add(tne);

}

}

hope this helps you.

Thanks,

Vivek.