Skip to Content
avatar image
Former Member

not displaying first row in the table

Hi

I created web dynpro application. In that table,,

Cardinality -


0 to n

Selection -


0 to n

public void wdDoInit()

{

//@@begin wdDoInit()

wdContext.currentLeaveElement().setLocation("1");

for (int i = 0; i < EMP.length; i++)

{

IPrivateEtrecLeaveEligView.ILeaveElement element = wdContext. createLeaveElement();

element.setDepartment(EMP<i>[0]);

element.setLeaveType(EMP<i>[1]);

element.setYear(EMP<i>[2]);

element.setTimeSpan(EMP<i>[3]);

element.setNumofdays(EMP<i>[4]);

element.setLevel(EMP<i>[5]);

wdContext.nodeLeave().addElement(element);

}

//@@end

}

In tha last declaration,,,,,,

private static final String EMP[][] =

{

{ "Supply Chain", "Annual Leave", "2008", "Yearly", "20", "JC-16 Manager grade"},

{ "Finance", "Sick Leave", "2008", "Yearly", "23", "WL-2A"},

{ "Brands & Development", "Monthly Leave", "2008", "Monthly", "23", "WL-4A"},

{ "Supply Chain", "Annual Leave", "2008", "Yearly", "23", "WL-5A"},

{ "Finance", "Sick Leave", "2008", "Yearly", "23", "WL-6A"}

};

But its not taking first row data in the table....

will any one please help me where i did mistake.

Regards

Sushma

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    Jan 30, 2009 at 11:02 AM

    Hi Sushma,

    Please check the below code written by you.

    for (int i = 0; i < EMP.length; i++)

    i think it should be

    for (int i = 0; i < EMP.length-1; i++)

    Regards

    Narendra

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 30, 2009 at 11:17 AM

    Cardinality -> 0..n

    Selection -> 0..1

    Code as.

    IPrivateExperimentView.ILeaveElement element;
       for( int i = 0; i < EMP.length; i++)
       {
       	 element = wdContext. createLeaveElement();
    
    		   element.setDepartment( EMP<i>[0]);
    		   element.setLeaveType(EMP<i>[1]);
    		   element.setYear(EMP<i>[2]);
    		   element.setTimeSpan(EMP<i>[3]);
    		   element.setNumofdays(EMP<i>[4]);
    		   element.setLevel(EMP<i>[5]);
    
       	wdContext.nodeLeave().addElement(element);
       }
    

    vinod v

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 30, 2009 at 11:35 AM

    hi Sushma,

    this may be because of selection value change the selection as 1.and cardinilty as 0 to n.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 30, 2009 at 01:34 PM

    Hi Sushma,

    there is no problem in the below code :

    for (int i = 0; i < EMP.length; i++)

    {

    IPrivateEtrecLeaveEligView.ILeaveElement element = wdContext. createLeaveElement();

    element.setDepartment(EMP[0]);

    element.setLeaveType(EMP[1]);

    element.setYear(EMP[2]);

    element.setTimeSpan(EMP[3]);

    element.setNumofdays(EMP[4]);

    element.setLevel(EMP[5]);

    wdContext.nodeLeave().addElement(element);

    }

    //@@end

    }

    but in the doinit method u have written this line :

    wdContext.currentLeaveElement().setLocation("1");

    which means that , u have create a LeaveElement some where before this line and thats the reason the first row of ur table is empty.

    if the location value is same for all rows(for all leave element) then in the for loop set the value of the location as shown below:

    element.setLocation("1");

    Hope it helps

    Thanks and Regards

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Correct. Maybe he has set cardinality=1:n instead of 0:n. In this case the runtime would create one node element automatically.

      Armin

  • avatar image
    Former Member
    Jan 30, 2009 at 08:45 PM

    Hi Sushma,

    Your code is perfectly fine. just change the cardinality of the node Leave from 1:n to 0:n and it will work just fine.

    Regards,

    Sanyev

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 31, 2009 at 10:15 AM

    hi sushma,

    code looks fine.

    1. check the cardinality of the node Level

    2. for the table, check the firstVisibileRow property is not set to 1; it is 0

    nikhil

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 05, 2009 at 05:39 AM

    tx

    Add comment
    10|10000 characters needed characters exceeded