cancel
Showing results for 
Search instead for 
Did you mean: 

pass values to Controller context

Former Member
0 Kudos

Hi ,

I am working on a apllication where I am getting the data from database and dispalying that in a table in a view.I am getting the data in the result set.Pl help me how do I pass the result set values to Controller context.

Thanks in Advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You need to rip of the values from the ResultSet and need to assign it to the Context Attribute of the Table's Context node.

You can go thru the below pdf - https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5f699f90-0201-0010-14a4-89501772...

It would be like

/ create a table

// create fields/columns

// add columns to the table

for( i=0;i<nodesize;i++)

{

// read value from RecordSet

// assign it to suitable table cell

//move to next record in the node and next row in the table

}

Thanks,

Raags

Former Member
0 Kudos

Hi Raghavendra,

Thanks for ur suggestion.But here is what I am doing.I have created the value nodes for the controller context.Now I need to pass the table vales from the Result set to Controller context.Any ideas?

Thanks,

Former Member
0 Kudos

There is no direct way to pass values from RecordSet to Context.

1. If your database table is Address with fields name, city, state.

2. Then you need to create a Value Node by name 'Address' in controller context

3. Add value attributes with name, city, state of type string.

4. Make sure the cardinality is 0..n

5. Now here comes your code..

6. Iterate thru ur RecordSet, get each records filed value

7. create the element of the 'address' node and assign the recordset's value to elements fields i.e, using setCity(), etc....

8. and makes ure you add the element to value node.. ie., wdcontext.nodeAddress.addElement(addresselement);

where addresselement is IAddressElement addresselement=wdcontext.nodeaddress.createAddresselement();

9. In this way you need to iterate and add the all records values from recordset to context

I hope you know how to access nodes/context of Controller from view code.

Thanks,

Raags

Answers (0)