Hi ,
I am New to 4gl
I am trying the following join but it is giving error. can someone correct it.. Thanks in advance.
for each item where item.seq_num = 1 and item.docid = 1,
for each batch where batch.batch_id = 'test' and item.batch_id = batch.batch_id no-lock
There should be only one FOR.
There should be only one FOR.
You also need to specify a lock for each table in the predicate. Personally I also prefer to have the predicates this way around.
for each item no-lock where item.seq_num = 1 and item.docid = 1,
each batch where batch.batch_id = 'test' and batch.batch_id = item.batch_id no-lock
In future please post your Progress version and the errors you receive as it will help folks track down the issues more readily.
Thomas helped on getting the answer, but I wonder why would you do that?
batch.batch_id = 'test' and item.batch_id = batch.batch_id
You already checked if batch.batch_id equals with 'test' and then you check if it's also equal to item.batch_id.
If you need any help on learning ABL you can start from here:
I suspect that there is a problem here since, as Gabriel points out, the condition can only be true when the item.batch_id = "test". If that is true, you can skip looking at the item at all because you want batches where batch_id = "test", but since batch_id sound like a unique key, you would only need a find instead of a for each.