cancel
Showing results for 
Search instead for 
Did you mean: 

How to typecast the given attribute.

Former Member
0 Kudos

Hi all,

I am getting an error.

I am using dropdownbyindex and using following code.

Iprivate<ur view name>.IEt_Fragen_output obj = wdcontect.nodeET_Fragen_output.creatEt_Fragen_outputelement();

List list1=new ArrayList();

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

{

IPrivateCompView.Idropdownnode data=wdContext.nodedropdown.createdropdownElement();

data.setvalue

->->->(wdcontext.currentcontextelment.getelementat(i).getfrange);

list1.add(data);

}

wdContext.nodedropdown.bind(list1);

now in this when i try to put (see arrows)currentcontextelment. then i do not get "getelementat(i)." method. Now how to typecast this. I need this method to use "getfrage".

plz help!!...Its urgent!!!

Cheers,

Darshna.

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Darshna,

Try this,

wdContext.nodeSampleFrange().getSampleFrangeElementAt(i).getFrange();

Then, did you solve your yesterday's problem (Context Exception) ? If so, Please let the viewers know. Reply to that thread, how it has been solved? It will help, not only the current viewers but also the future viwers, to know how this problem has been solved.

Thanks and Regards,

Prabhakar.

Former Member
0 Kudos

Hi,

Don't get confused..

->->->(wdcontext.currentcontextelment.getelementat(i).getfrange);

list1.add(data); this part of your code won't work at all. Because on wdContext you can't call the method like get Elementat(i) because it caontains single lements only...

In my code I have used value from an array.. If you want to get values from any other node then just get that value and setit in your Values frag current element and add that frag element in list object as I have done..

Thanks and Regards

Avijit

Former Member
0 Kudos

Hi,

here is your code. I am using the same structure as you said.

ValueCollection (value node)

-


Values (value node)

-


frage (value attribute)

	String[] Names = new String []
	{
	   "Monthly","Weekly"};
	List monthsOrWeek = new ArrayList();
IPublic<Component Name>.IValuesElement valuesElement = null;
	for (int i =  0; i < Names.length; i++)
	{
		valuesElement = wdContext.createValuesElement(); 
		valuesElement.setFrage(Names<i>);   
		monthsOrWeek.add(valuesElement);
	}
	wdContext.nodeValues().bind(monthsOrWeek);

Hope it helps. Please reward points if it helps....

Thanks and Regards

Avijit

Former Member
0 Kudos
	String[] Names = new String []
	{
	   "Monthly","Weekly"};  // Collection of your drp dwn values
	List monthsOrWeek = new ArrayList();  // list onject 
	IPublicTpcalender.ICalIDSHDtailsElement calIDSHElem = null;	// Value node towhich your drp dwn is bound
	for (int i =  0; i < 2; i++)
	{
		calIDSHElem = wdContext.createCalIDSHDtailsElement();   // create an element for each entry
		calIDSHElem.setRepFreq(Names<i>);  // set the value in the element 
		monthsOrWeek.add(calIDSHElem); // put that element in the list
	}
	wdContext.nodeCalIDSHDtails().bind(monthsOrWeek); // out of loop bind that list to your element 
	wdContext.nodeCalIDSHDtails().setLeadSelection(1); // set a lead selection fro drp down 	

use this code....

please reward points if it helps...

thanks and Regards

Avijit

Former Member
0 Kudos
	String[] Names = new String []
	{
	   "Monthly","Weekly"};
	List monthsOrWeek = new ArrayList();
	IPublicTpcalender.ICalIDSHDtailsElement calIDSHElem = null;	
	for (int i =  0; i < 2; i++)
	{
		calIDSHElem = wdContext.createCalIDSHDtailsElement(); 
		calIDSHElem.setRepFreq(Names<i>);   
		monthsOrWeek.add(calIDSHElem);
	}
	wdContext.nodeCalIDSHDtails().bind(monthsOrWeek);
	wdContext.nodeCalIDSHDtails().setLeadSelection(1);	
	wdContext.nodeSearchCALID().addElement(wdContext.nodeSearchCALID().createElement());
former_member187990
Participant
0 Kudos

Hi,

Here is the Link for adding element to DropDownByIndex.

http://help.sap.com/saphelp_nw04/helpdata/en/95/93fe1e71a2e44691b1f041e67f71aa/frameset.htm

An Example is shown for adding values to DropDownByIndex.

If frange is a context attribute then

there is no possibilty of using like this

wdcontext.currentcontextelment.getelementat(i).getfrange;

Because the attributes can have only one value and you cannot use getelementat(i).

Former Member
0 Kudos

You can't get the the currentcontext. lementat in that way. To populate your drpydown with your value first Populate a list ( java.util) object with all your values. Now create a value node like tha following

Values

-


AllValues

and bind that list withyour value node. Now bind this value node to your drp down.

Thanks and Regard

Avijit

Former Member
0 Kudos

Hi Avjit,

Can you please help me with code.

I am not getting you. How to do that?

I have a node and in that another node and then my attribute called "frage"

So how do i do dat.

Cheers,

Darshna.

Former Member
0 Kudos

Hi,

Considering context structure to

-NodeA

---NodeB

-


frage

List list1=new ArrayList();

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

{

IPrivateCompView.Idropdownnode data=wdContext.nodedropdown.createdropdownElement();

data.setvalue

->->->(wdcontext.NdoeB.getElementAt(i).getfrange);

list1.add(data);

}

wdContext.nodedropdown.bind(list1);

Message was edited by:

Shriram Kabra