ks_ks_
24th February 2009, 05:55
Hi,

My requirement is :

I have a couple of form fields based on which I have to pull the data from 2 different tables.

the form fields are common for the both the tables.

I dont want to join the tables rather want to pull the data from both the tables seperately.


E.g: Form fields a.f,a.t, b.f,b.t, c.f,c.t.

Now the 2 tables are X and Y.

if I want to pull the data from only X, then I would write:

select x.*
from x
where x.a between a.f and a.t
and x.b between b.f abd b.t
and x.c between c.f and c.t


the same code would be applicable to table Y as well.

Can anybody please help me to do this.

sprasad
24th February 2009, 07:34
You can try this where join is not used


select x.*
from x
where x.a between a.f and a.t
and x.b between b.f abd b.t
and x.c between c.f and c.t
selectdo
select y.*
from y
where y.a =:x.a
and y.b =:x.b
and y.c =:x.c
selectdo
endselect
endselect

ks_ks_
24th February 2009, 10:30
Thanks sprasad.

Your idea worked for me.

Now my problem is that I want to print the data from there 2 tables, that is X and Y.

In the report layout, if I give the data from table X in detail.1 and data from table Y in detail.2, then it prints like this:

x.field.record1
y.field.record1
x.field.record2
y.field.record2
x.field.record3
y.field.record3

But I want it to be printed like this:
x.field.record1
x.field.record2
x.field.record3

then when all the records from table X are done.

y.field.record1
y.field.record2
y.field.record3

please help.

sprasad
7th March 2009, 12:00
One way of achieving this is select the tables independently then send data and use flags in print condition of detail layout.


select x.*
from x
where x.a between a.f and a.t
and x.b between b.f abd b.t
and x.c between c.f and c.t
selectdo
flag_x = TRUE
flag_y = FALSE
rprt_send()
endselect
select y.*
from y
where y.a between a.f and a.t
and y.b between b.f abd b.t
and y.c between c.f and c.t
selectdo
flag_x = FALSE
flag_y = TRUE
rprt_send
endselect


Use these flags in print condition of detail layout

ks_ks_
7th March 2009, 14:01
hi sprasad,

Thanks for your reply, the problem has been resolved.

I had to write 2 different functions to get the data from both the tables, and store the values from different tables in a single variable. rprt_send for both the function resolved the problem.

Tx,
KS

smusba
8th March 2009, 14:21
Hi,

Can u send me the script for me. I am facing same problems for my report layouts