on 07-17-2007 9:55 AM
Hi All,
I have following line of code in my program
Object attributeValue = wdContext.currentContextElement() .getAttributeValue( fldName);
Now I have to display the "attributeValue" on my output screen after this line of code is processed. What is the code for that?
Thanks in advance.
HI,
First let me say wat I understood.
U want to display the value of the variable <b>attributeValue</b> to output.
If yes, u can display it in a textView by
wdContext.currentContextElement().setText(""+attributeValue);
where <b>Text</b> is the context variable bount to textView
Regards
Fahad Hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
U can make use of message manager for this as
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess
(""+attributeValue);//FOR SUCCESS MESSAGE
wdThis.wdGetAPI().getComponent().getMessageManager().reportWarning(""+attributeValue);//FOR WARNING MESSAGE
wdThis.wdGetAPI().getComponent().getMessageManager().reportException(""+attributeValue,false);//FOR ERROR MESSAGE
If u want to set the value in the same fashion that u got the value, u can try this
wdContext.currentContextElement().setAttributeValue("Text",attributeValue);
But here also, Test is a context variable
Regards
Fahad Hamsa
Hi Bharath,
You can display the value using MessageManager or using popup also
Take a Button (say ShowValue)
1> Inside the action of the button (ShowValue) use the code
Object attributeValue = wdContext.currentContextElement() .getAttributeValue("fldName");
wdComponentAPI.getMessageManager().reportSuccess("Arrtribute Value : "+attributeValue.toString());
2> To display the value using popup.
Go to the Methods tab. Create an Event handler (say Ok)
Inside the action of the button(ShowValue) use the code
Object attributeValue = wdContext.currentContextElement() .getAttributeValue("fldName");
String dialogText="You have Entered : "+attributeValue.toString() ;
IWDConfirmationDialog confDialog = wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,wdThis.wdGetAPI().getViewInfo().getViewController().findInEventHandlers("Ok"),"Ok");
confDialog.show();
Regards,
Mithu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Create a value attibute va and bind it to textview which you want to diplay it in next line
Object attributeValue = wdContext.currentContextElement() .getAttributeValue( fldName);
wdContext.currentContextElement().setva(""+attributeValue);
If you want to display the value as a meassage
Object attributeValue = wdContext.currentContextElement() .getAttributeValue( fldName);
wdComponentAPI.getMessageManager().reportSuccess(""+attributeValue);
Also go through this API for working with different type of mesage
Thanks and Regards,
Arun
Message was edited by:
Arun Srinivasan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
My display problem is solved but one more problem occured .
I am using one "save" button here.If we click that button the data entered is saved.
For that i wrote code in "onactionsave" method.In that method I am checking the
Mandatory data in the input field.If data is not entered in the inputfield then it should give error message.It is working fine for the first time.But if i enter data in the input field and press save ,my data is saving and then if I remove the data using "backspace" and then again if i press " save" ,it is not giving the error message.
Thanks in advance.
HI,
Do like this
String var=wdContext.currentContextElement().get<Val>();
if(var==null)
{
wdComponentAPI.getMessageManager().reportException("Enter value",true);
}
else if(var.trim().equals(""))
{
wdComponentAPI.getMessageManager().reportException("Enter value",true);
}
else
{
wdComponentAPI.getMessageManager().reportSuccess("Success");
}
Regards
Fahad Hamsa
hi
code
//@@begin javadoc:onActionsave1(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionsave1(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionsave1(ServerEvent)
String Name=wdContext.currentContextElement().getVA_Name();
if(Name.trim() == null)
{
wdComponentAPI.getMessageManager().reportWarning("Please enter the Name");
}
else
{
wdComponentAPI.getMessageManager().reportSuccess("Please enter Name is "+Name);
wdContext.nodeVN_Dropdown().moveFirst();
}
//@@end
}
Regards,
Arun
Hi
You can also use wdThis.wdGetComponentAPI().getMessageManager().reportSuccess( attributeValue.toString() );
Regards
Abhimanyu L
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You dont need to get the value of the attribute.
Instead create a UI element TextView/InputField and bind the property of the UI element to the context attribute.This will directly show the value in the view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.