Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to reduce all my code from my tJava so I'm trying to use Routine in a Job ToS for ESB 7.1.1.
For example :
I'm doing a request from a table :
"SELECT COLUMN_NAME FROM TABLE WHERE TABLE_NAME = '"+context.Table+"' AND DATA_TYPE = 'DATE'"
and I save the result in an Arraylist in a tJavaFlex:
But when I have to use it in a different tJava I have to do this :
int NbColumnDate = (Integer)globalMap.get("NbColumnDate"); for (int i = 0; i < NbColumnDate; i++) { ColumnDate.add(((ArrayList)globalMap.get("ColumnNameDate")).get(i).toString()); }
So I want to put this in a Routine and just call it when I need to use this code.
I would like to know if it's possible to use context and globalMap var in custom Routine. If yes, can someone show me the way ?
When I try to use globalMap.get("myVar") or context.myVar an error is raised : context cannot be resolved to a variable and globalMap cannot be resolved to a variable.
Thank you for any help,
Regards.
So after many try here is my answer :
My routine :
public static ArrayList<String> arrayListGlobalMap(ArrayList<String> myArray) { ArrayList<String> MyArray = myArray; return MyArray; }
The call in my tJava :
ArrayList<String> MyArray = new ArrayList<>(); MyArray = Java_Insert_Routine.arrayListGlobalMap((ArrayList)globalMap.get("myGlobalArray"));
So after many try here is my answer :
My routine :
public static ArrayList<String> arrayListGlobalMap(ArrayList<String> myArray) { ArrayList<String> MyArray = myArray; return MyArray; }
The call in my tJava :
ArrayList<String> MyArray = new ArrayList<>(); MyArray = Java_Insert_Routine.arrayListGlobalMap((ArrayList)globalMap.get("myGlobalArray"));