on 02-05-2008 10:41 PM
Hi!
How can I store or save in context node value
more than one data. For example the content
of an Array or Container etc...
regards
sas
Hi sas,
Suppose you have an array countries[]={"UK","Italy","Germany"} and you want to store it in a node 'Country' with a value attribute 'name'. Suppose the node is created in your view's context and view name is 'TestView' . This is how you do it.
IPrivateTestView.ICountryElement element=null;
for(int i=0;i<countries.length();i++){
element=wdContext.nodeCountry().createCountryElement();
element.setName(countries<i>);
wdContext.nodeCountry().addElement(element);
}
Regards,
Shabeer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How can I store or save in context node value
more than one data. For example the content
of an Array or Container etc...
String Result ="";
String Array[] = {"a","b","c","d","e"};
for(int i=0;i<Array.length();i++)
{
Result += Array<i>+",";
}
wdContext.currentNode().setValue(Result);
Use StringTokenizer while retriving,
String Final = wdContext.currentNode().getValue();
StringTokenizer Tokenizer = new StringTokenizer(Final,",");
int i=0;
while(Tokenizer.hasMoreElements())
{
Array<i> = Tokenizer.nextToken();
i++;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hai erdam sas
try this code ,it easy n it works
create a context node and an attribute under that node use ur node and attribute in this code.bine that node to the drop down by index UI element in Layout.
try
{
IPrivateKv_bus.IKvnodeNode kvlevel=wdContext.nodeKvnode();
List lis=new ArrayList();
for(int i=0;i<4;i++)
{
if(i==0)
{
IPrivateKv_bus.IKvnodeElement el11 = kvlevel.createKvnodeElement();
el11.setKvlevel("Select kvlevel");
lis.add(el11);
}
if(i!=0)
{
IPrivateKv_bus.IKvnodeElement el11 = kvlevel.createKvnodeElement();
el11.setKvlevel("kvlevel"+i);
lis.add(el11);
}
}
kvlevel.bind(lis);
}
catch(Exception e)
{
}
place this coding in init method of your view.any issues plz let me know.
Thanks n Regards
Sharanya.R
Edited by: Sharanya.R on Mar 25, 2008 1:08 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Cay you please tell me the difference between
bind and create. We have here both versions
at the below shown example.
Regards
sas
IPrivate<View Name>.IProductsElement product = wdContext.createProductsElement();
product.setName("Product 1");// Name attr under node Products
product.setPrice("89,90"); // Price attr under node Products
product.setProductId("P1");// ProductId attr under node Products
product.setQuantity(850); // Quantity attr under node Products
product.setDetails("Detailed description of product PP-1020");
products.add(product);
product = wdContext.createProductsElement();
product.setName("Product 2");
product.setPrice("849,00");
product.setProductId("P2");
product.setQuantity(12);
product.setDetails("Detailed description of product 2");
products.add(product);
wdContext.nodeProducts().bind(products);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
wdContext.createProductsElement();
Above statement creates a new element for products node, but the element is <b>not</b> bound to the node.
To make this element part of the node you can use either of the following
Use bind(IProductsElement)} or
IWDNode bind(Collection)} to bind it, here you can bind mulitiple elements.
or IWDNode addElement(IWDNodeElement)
to add it to the node.
Alternatively yuo can use createAndAndOrdersElement()
So they all do the same.
Regards
Ayyapparaj
Hi Raj,
im having the same scenario as this....
I'm having some 10 dropdowns.
The selected names in these dropdowns i'm saving back in R/3.
In the view i'm having a node vn_selectedmembers and a attribute va_fullname and va_usergroup.
Now i need to save all the selected names in the same attribute vafullname and their corresponding usergroup in va_usergroup_.
right now i'm having seperate action for every dropdown and setting the selected names and its user group to the attribute va_fullname and va_usergroup respectively in the on action method of each dropdown.
but its taking only the last selected value, that is the attribute has only one name.
how to solve this? please explain me with detailed procedure
Regards,
Suresh
Hi,
Suppose you have details of products in a list.
Then you can put these data into node using:
List products = new ArrayList();
wdContext.nodeProducts().bind(products);
// where Products is your node.
Or if you have lot other info for product, then:
IPrivate<View Name>.IProductsElement product = wdContext.createProductsElement();
product.setName("Product 1");// Name attr under node Products
product.setPrice("89,90"); // Price attr under node Products
product.setProductId("P1");// ProductId attr under node Products
product.setQuantity(850); // Quantity attr under node Products
product.setDetails("Detailed description of product PP-1020");
products.add(product);
product = wdContext.createProductsElement();
product.setName("Product 2");
product.setPrice("849,00");
product.setProductId("P2");
product.setQuantity(12);
product.setDetails("Detailed description of product 2");
products.add(product);
wdContext.nodeProducts().bind(products);
Hope this will help you.
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sas,
Better way to store in java.util objects. Create context variable whose type is List or ArrayList or HashMap.
Set and get in the regular way to / from the context.
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.