on 09-03-2008 3:28 AM
Dear All,
When Bapi have create a table ,example as (part field):
name | age | Paper_Receipt |
Anne -
20 -
1
Andy -
22 -
0
now, WebDnypro call this Bapi and display this table in portal
as this rule :
1. if paper_Receipt is "1" then display "Y"
2. if paper_Receipt is "0" then display "N"
Result :
name | age | Paper_Receipt |
Anne -
20 -
Y
Andy -
22 -
N
I want come out this funtion ,but have can't transfer the 2nd record , can't turn 0 to N
there are my code (part)
public void onPlugMain_In_Detail
{
int rowsize_ER;
rowsize_ER = wdContext.nodeZtrip_Receipt().size();
if (rowsize_ER > 0)
{
if (Integer.parseInt(wdContext.currentZtrip_ReceiptElement().getPaper_Receipt().toString()) == 1)
wdContext.currentContextElement().setAtt_ment("Y");
if (Integer.parseInt(wdContext.currentZtrip_ReceiptElement().getPaper_Receipt().toString()) == 0)
wdContext.currentContextElement().setAtt_ment("N");
}
}
and the value of table field Paper_Receipt I set is Att_ment
but the result is
name | age | Paper_Receipt |
Anne -
20 -
Y
Andy -
22 -
Y
can you help me how to change can succee?
Hi Doke,
Try out this code:
Create a child node Attach in node Ztrip_Receipt
Set node properties cardinality 1..1
singleton false
in the node Attach create an attribute att_ment.
Like this you can create any number of elements in he node that you want to show in the table.
public void onPlugMain_In_Detail()
{
int rowsize_ER = wdContext.nodeZtrip_Receipt().size();
for(int i=0;i< rowsize_ER; i++)
{
if (Integer.parseInt(wdContext.nodeZtrip_Receipt().getZtrip_ReceiptElementAt(i).getPaper_Receipt().toString()) == 1)
wdContext.nodeZtrip_Receipt().getZtrip_ReceiptElementAt(i).nodeAttach().currentAttachElement().setAtt_ment("Y");
else
if (Integer.parseIntwdContext.nodeZtrip_Receipt().getZtrip_ReceiptElementAt(i).getPaper_Receipt().toString()) == 0)
wdContext.nodeZtrip_Receipt().getZtrip_ReceiptElementAt(i).nodeAttach().currentAttachElement().setAtt_ment("N");
}
}
Regards
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Siva,
I feel you method is right, I do some operation according to
your said,
but there have a error with redline under the node nodeAttach() in code ,and error message is
" the method nodeAttach is underfind for the type IPrivateTrip_Detail.IztripZtrip_ReceiptElement "
you can see these pices
http://www.anydesign.cn/UpFile/UpAttachment/2008-9/200894113059.gif
http://www.anydesign.cn/UpFile/UpAttachment/2008-9/200894113048.gif
can you give me some way ?
thanks!
Thank you very much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Doke,
Then it must the problem with loop. Keep the code seperated by each and every brace and check it.
See the below code
int rowsize_ER;
rowsize_ER = wdContext.nodeZtrip_Receipt().size();
for (int i = 0;i<rowsize_ER ;i++)
{
if (Integer.parseInt(wdContext.currentZtrip_ReceiptElement().getPaper_Receipt().toString()) == 1)
{
wdContext.currentContextElement().setAtt_ment("Y");
}
else
{
wdContext.currentContextElement().setAtt_ment("N");
}
}
This will help u
Thanks
Suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Suresh.
after I use you code , the result is error , i find the " i "can't use
table result :
Anne -
20 -
Y
Andy -
22 -
Y
I want table result is :
Anne -
20 -
Y
Andy -
22 -
N
because the dada from BAPI is
Anne -
20 -
1
Andy -
22 -
0
can you know my idea? I feel the code have some error on
deal with the 3st col .
Thanks!
Hi,
Do you have the model node directly bound as the data source of the table UI element? What is your context structure? If you are using this code
wdContext.currentContextElement().setAtt_ment("Y")
then all the rows in the Paper_Receipt column will have "Y" (basically they'll all have the same value), because the root node has cardinality 1...1, but for table you need a node of cardinality 0...n or 1...n.
Regards,
Satyajit.
Hi Doke,
The below code
public void onPlugMain_In_Detail
{
int rowsize_ER;
rowsize_ER = wdContext.nodeZtrip_Receipt().size();
if (rowsize_ER > 0)
{
if (Integer.parseInt(wdContext.currentZtrip_ReceiptElement().getPaper_Receipt().toString()) == 1)
wdContext.currentContextElement().setAtt_ment("Y");
if (Integer.parseInt(wdContext.currentZtrip_ReceiptElement().getPaper_Receipt().toString()) == 0)
wdContext.currentContextElement().setAtt_ment("N");
}
}
Are you using any loops and putting the above code in loop ? If so , why don't you use the else instead of two "if()" conditions.
public void onPlugMain_In_Detail
{
int rowsize_ER;
rowsize_ER = wdContext.nodeZtrip_Receipt().size();
if (rowsize_ER > 0)
{
if (Integer.parseInt(wdContext.currentZtrip_ReceiptElement().getPaper_Receipt().toString()) == 1)
wdContext.currentContextElement().setAtt_ment("Y");
else
{
wdContext.currentContextElement().setAtt_ment("N");
}
}
}
try this
thanks
Suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Can u make it simple and more clearer what u need and what u have done ?
thanks
Suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear All,
I add some relatively pictures on this link
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.