cancel
Showing results for 
Search instead for 
Did you mean: 

how to get seeburger work bench counter value

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member181962
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

former_member200962
Active Contributor
0 Kudos
 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.

Check this similar discussion for PI7.1:

Regards,

Abhishek.

Former Member
0 Kudos

Hi Abhishek,

When i create a seeburger workbench counter, its a global variable. and i can use it accross mapppings. so my question is more about how to get the counter value without incrementing it. and why am i getting class cast exception in my function?

Regards,

Rashmi

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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);
}