I have two oracle recordset(output of sql executors).
let me say recordset A has two column segment_id and cable_id
and one more recordset B has segment_id and Previous_segment_id
record set A
SEGMENT_ID | CABLE_ID
21 | 0
111 | 0
53 | 0
68 | 1
1 | 0
Recors set B
SEGMENT_ID | PREVIOUS_SEGMENT_ID
21 | 111
111 | 53
53 | 68
68 | 1
1 | 9
Function needed here is...
if the set cable_id of segment_id is 0(zero), then
I need to loop thru Second set B by fetching previous Ids.(i pasted image below)
in the example for the segment_id 21, cable id is 0, so i have to move forward by taking its previous id(PREVIOUS ID IS IN SET B)
which is 111, but for for 111 again cable id is zero(in the record set A), so kepp on looping
until i get 68( because for 68 cable id is 1). now i need to stop here because i got some positive value(greator than zero)
at the end for segment id 21 should have cable id 1. like wise
segment_id 11 =cable id 1
segment_id 53 = cable id 1
how can i achive this thru fme ?