on 09-05-2007 3:55 PM
I need to read the Key valuefrom the message pool using the text value for the Key.. Is it possible.. Please help me with sample code..
Thanks and Regards
Avijit
Hi Satyajit ,
the code that you have written does not meet my requirement because I only have the text value.. not the key.. I will have to find the key using the text value.
Thanks
Avijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Thanks for your reply.. but my requirement is opposite to the one you specified. I have to read the Key value from the Message Pool using the text.
Please help.
thanks and Regards
Avijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Avijit,
I got your requirement. I really dont know the scenario your working on but its possible to do it. There is no direct way to do so, but complexity is in getting to know the Keys dynamically from interface.
Here you go..
try
{
Class msgClass = IMessageTestWDApps.class;
//Replace IMessageTestWDApps with IMessage<Your WD Component name>
Field keys[] = msgClass.getFields();
IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();
if(keys != null)
{
String key = "";
for(int index=0;index<keys.length;index++)
{
key = keys[index].getName();
wdComponentAPI.getMessageManager().reportSuccess("Key= "+key);
if(textAccessor.getText(key).equals("My message text"))
{
//your logic.
}
}
}
}
catch(Exception cnfe)
{
wdComponentAPI.getMessageManager().reportException("Exe "+cnfe.getMessage(),false);
}
Regards
Abhilash
Message was edited by:
Abhilash Gampa
Hi Avijit,
Here is the sample code to get the text from Msg pool.
IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();
textAccessor.getText("KEY1");
//OR
textAccessor.getText(IMessage<CompName>.KEY2);
Regards
Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.