on 08-12-2009 1:23 PM
hi all,
i want to get the current counter value in the seeburger workbech counter.
i used the following function suggested in one of the threads in forum, but its giving the below error
func used:
try {
VariableBean be=VariableFactory.getVariableInstance("");
return be.getStringVariable(variableName);
} catch (Exception e) {
throw new RuntimeException(e);
}
error:
RuntimeException in Message-Mapping transformation: Exception:[java.lang.RuntimeException: java.lang.RuntimeException: VariableBeanServlet: Could not call getVariable() method of the Servlet. Cause=java.lang.ClassCastException]
i guess this above function is to get variable value and not counter value. can any body give me code to get counter value.
Thanks a lot in addvance
Regards,
Rashmi
Edited by: Rashmi H S on Aug 12, 2009 2:30 PM
Hi Rashmi,
If you use Counter Factory, the counter gets automatically incremented when you use the nextCounter function.
For your requirement you have to use only Variables, which you have tried already.
Check the function parameters that need to be passed when using the get functions of the Variablefactory class.
May be , just send the actual variable name to the be.getStringVariable() function
for eg if the variable name is VN
retrun be.getStringVariable("VN");
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI ,
In addition to above please check that The SeeFunctions tables must have been deployed in the J2EE server.
Check in Seeburger Namespace under Imported Archives -->SeeFunctions.
Java Code:
try {
CounterBean be=CounterFactory.getCounterInstance();
return "" + be.nextCounter("MYCOUNTER");
} catch (Exception e) {
throw new RuntimeException(e);
}
Thanks & Regards,
Anurag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anurag and Luis,
this function also increments the counter. but i dont want to increment it. my scenario more precisely is, i'm expecting two messages in EOIO and correspondingly i've two mappings, in the first one i need to increment the counter and in the second i just want to read the counter value without incrementing it.
any help?
also any idea, why was i getting class cast exception?
Regards,
Rashmi
Edited by: Rashmi H S on Aug 13, 2009 5:58 AM
So
Try to use this code to get your counter.
Put a parameter "yourcounter"
GlobalContainer myGlobalContainer;
myGlobalContainer = container.getGlobalContainer();
if (myGlobalContainer.getParameter("yourcounter") == null) {
return "";
}
else {
return (String)myGlobalContainer.getParameter("youcounter".toUpperCase());
}
Otherwise you can get the counter (the first code above with the counter increment ) then set the counter in and variable seeburguer.
And use the variable seeburguer in other elements.
Source >> GetCounter >>SetVariable
use getCounter
//write your code here
try {
CounterBean be=CounterFactory.getCounterInstance();
return ""be.getCounter("counterName_"b"_"a );
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
will return the same counter what you have ,I also had same scenario what you are facing recently
HTH
Rajesh
Edited by: Rajesh on Aug 13, 2009 7:49 PM
Hi
Please use this function to get counter.
imports com.seeburger.functions.permstore.impl.*;com.seeburger.functions.permstore.*;
//write your code here
try {
CounterBean be=CounterFactory.getCounterInstance();
return "" + be.nextCounter(counterName);
} catch (Exception e) {
throw new RuntimeException(e);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.