mrreds
10th August 2010, 23:54
Hi everyone!
I'm getting all my expected lines using the tool "Query by Easy SQL".

Every line has a key field, this key field could be or not in another table, and probably more than on time.

The values of the first table should be printed no matter what the second table.

How can I do this? script?

Sample:

Name. Places Visited.
------- -------------
Tim China
Tim Alaska
Sam " "
John Germany.

mark_h
11th August 2010, 16:31
Well you can lookup the UNREF feature of Baan SQL, not sure that works in easy sql. I believe it also means the references are setup to link these two tables on that field. Personally I do not use it. In a case like this I would either write a report session or use the report script. Using the report script you can find the key field from the primary table, pass it to the report. Then in the report script you can check the second table and do layout again for multiple values.

mrreds
11th August 2010, 20:11
Thank you mark_h !

I'll pick the layout again option. I have not used it so far.

Could you please share with me how to use it?

mark_h
11th August 2010, 23:10
Just search this forum on layout.again on thread titles only. That will give some examples on how to use it.

mrreds
14th August 2010, 07:13
Thank you Mark!

I created this script, but it has a no ending loop.

How can I fix it?


Declaration:
table twhinr150

extern domain tccwar ohcwar
extern domain whloca ohloca
extern domain tcqiv1 ohqty
extern domain tcbool lay.again

detail.1:
before.layout:

after.layout:
lay.again = true

detail.2:
before.layout:

select *
from whinr150
where whinr150.item = :whinh215.item
as set with 1 rows
selectdo
ohcwar = whinr150.cwar
ohloca = whinr150.loca
ohqty = whinr150.stks
lay.again = true
selectempty
lay.again = false
lattr.print = false
endselect

after.layout:

if lay.again then
layout.again()
else
lay.again = true
endif

mark_h
16th August 2010, 15:32
That is something you will need to figure out. I am not familiar these tables, my guess would be something like this:

detail.1:
before.layout:
ohcwar = ""

detail.2:
before.layout:
select *
from whinr150
where whinr150.item = :whinh215.item
and whinr150.cwar > :ohcwar
as set with 1 rows
selectdo
ohcwar = whinr150.cwar
ohloca = whinr150.loca
ohqty = whinr150.stks
lay.again = true
selectempty
lay.again = false
lattr.print = false
endselect

You want to just keep getting the next record each time - something like this would work through the list.

mrreds
17th August 2010, 23:59
It is working!!! thank you!