cancel
Showing results for 
Search instead for 
Did you mean: 

Seeburger variable?

Former Member
0 Kudos

Hey Experts,

I need to create a Seeburger variable and if a given condition is met, increase it and save it again with that new value (and so on), if not leave it like it was loaded initially with any change

for example, i have created a Seeburger variable called "CounterVar"

CounterVar at first try will be 0

Could anyone provide a example java code to do that? (I do know about Seeburger variables but I really don't understand much of Java code to do that)

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Here is a sample code to update a variable which exists in Seeburger Workbench -> Mapping Variables -> Variables.

1. Created a variable called "SS_Test_Var".

2. Inside my mapping, I created a UDF called "Update_SS_Test_Var" with the following code:


public String Update_SS_Test_Var(String a,Container container)

try {
	VariableBean be=VariableFactory.getVariableInstance(""); 
	be.setStringVariable("SS_Test_Var",a);
	return a;
} catch (Exception e) {
	throw new RuntimeException(e);
}

3. Don't forget to add the following class in the IMPORTS section of the UDF:


com.seeburger.functions.permstore.*;

Hope this helps,

Sumant.

Former Member
0 Kudos

Thanks for the quick reply, but there's something i'm not understanding..

I need a map like this:

(parameter: variable name in seeburger) ==> UDF ==> FieldtoMap

if the variable name in seeburger is "SS_Test_Var" and his value is 1, i need to read that, check a certain condition, and if true, increase it by one, and set it like 2 in seeburger

I tried your code using (my variable in seeburger is called "SS_Test_Var" = 1):

SS_Test_Var ==> UDF ==> FieldTomap

and i get the SS_Test_Var overwritten to "SS_Test_Var"

So the problem is that i need to overwrite the variable with his own value, not with a new value

i don't know much about these setences but after the:

VariableBean be=VariableFactory.getVariableInstance("");

where do you have the current value of the seeburger variable?

Former Member
0 Kudos

This is working for me :

//write your code here

        • Code for reading and incrementing the variable*

try {

CounterBean be=CounterFactory.getCounterInstance();

return ""+be.nextCounter(a );

} catch (Exception e) {

throw new RuntimeException(e.getMessage());

}

It increment the counter and return.

If you want to set variable first time :

try {

VariableBean be=VariableFactory.getVariableInstance("");

be.setStringVariable("VARIABLENAME",value);

return "";

} catch (Exception e) {

throw new RuntimeException(e);

}

If you only want to read the variable :

try {

VariableBean be=VariableFactory.getVariableInstance("");

return be.getStringVariable("VARIABLENAME");

} catch (Exception e) {

throw new RuntimeException(e);

}

Let me know if you have any difficulties regarding the same.

Thanks & Regards,

Dijesh Tanna.

Former Member
0 Kudos

If you want to see the status of any of this variable manually, visit the link

http://<host>:50000/seeburger or http://<host>:50000/SeeFunctionsFrontend

Thanks & Regards,

Dijesh Tanna.

Former Member
0 Kudos

Thanks Sumant & Dijesh! the function works correctly now

Answers (0)