on 2005 Nov 29 6:24 PM
Hi,
I am trying to invoke my message handling functions for validation checks against inputs that are going to be passed to RFC. In the 'Defining message' tutorial a Value Attribute is created in the 'Context' and a Simple DataType. In my model I have a Model Node which has context mapping. What do I have to replace in the code:
public void checkMandatory(java.lang.String fieldName) {
IWDMessageManager messageMgr =
this.wdComponentAPI.getMessageManager();
Object attributeValue =
this.wdContext.currentContextElement().getAttributeValue(fieldName);
IWDAttributeInfo attributeInfo =
this.wdContext.getNodeInfo().getAttribute(fieldName);
if (attributeValue instanceof String) {
if (((String) attributeValue).length() == 0) {
String fieldLabel =
this.wdContext.getNodeInfo().getAttribute(fieldName)
.getSimpleType().getFieldLabel();
messageMgr.reportContextAttributeMessage(
this.wdContext.currentContextElement(),
attributeInfo,
IMessageSimpleErrors.MISSING_INPUT,
new Object[] { fieldLabel },
true);
}
}
}
to make it work with my model? As the above throws the following exception for me:
<b>ContextException: NodeElement(SearchNCRView.0): unknown attribute Number</b>
where Number is the name of the context mapped element under Model Node.
Also the following code also throws an exception for me:
public void wdDoInit()
{
wdContext.getNodeInfo().getAttribute("Number")
.getModifiableSimpleType().setFieldLabel("NCR Number");
}
Can anyone please help?
KG
Request clarification before answering.
Regarding Exception at wdDoInit():
If "Number" is mapped, You can't use any methods of <i>ISimpleTypeModifiable</i> from the View.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Instead of referencing the attribute from View Context, Access from the Component context.
Suppose that "Number" of View context is mapped to "CompNumber" of Component Controller.
Instead of
wdContext.getNodeInfo().getAttribute("Number")
use:
wdThis.wdGet<ComponentName>Controller()
.wdGetContext().getNodeInfo().getAttribute("CompNumber")
User | Count |
---|---|
81 | |
30 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.