Posted: Tue Apr 23, 2013 5:43 am Post subject: getFirstElementByPath
Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
HI to All,
I have ESQL code coping data from SHARED into Env.Var.
lp : WHILE j <= i DO
SET ENV.IMSGWF.FLUSH_AREA_85.IMSGWF.DU_RCVD_TS[j] = IMSGWF_TABLE_85_ARRAY.IMSGWF.DU_RCVD_TS[j];
SET ENV.IMSGWF.FLUSH_AREA_85.IMSGWF.TECH_FNCTN_ID[j] = IMSGWF_TABLE_85_ARRAY.IMSGWF.TECH_FNCTN_ID[j];
SET j = j + 1;
END WHILE lp;
Data is passed into JCN:
for(int loop85=1;loop85<=Table85Cnti;loop85++) {
String TECH_FNCTN_ID = env.getFirstElementByPath("IMSGWF/FLUSH_AREA_85/IMSGWF/TECH_FNCTN_ID["+loop85+"]").getValueAsString();
String DU_RCVD_TS = env.getFirstElementByPath("IMSGWF/FLUSH_AREA_85/IMSGWF/DU_RCVD_TS["+loop85+"]").getValueAsString();
The first JAVA String TECH_FNCTN_ID always gets NULL.
What is the getFirstElementByPath syntax to get data from env.var array ?
Never use [j] syntax to access or update ESQL tree members.
It's horrible for performance. When you ask it to access, say, [5], it has to navigate to first child and then navigate to next sibling four times. When you then ask it to access [6], it has to navigate to first child and then navigate to next child five times.
Your esql should be rewritten to use first child and next sibling and reference variables.
Likewise your Java code should explicitly loop over first child and next sibling references.
So you would do something like (and notice the magic of using [ code ] tags)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum