shywanna
25th June 2008, 22:32
In my report script I want to pull the Purchase Orders with items marked for inspection from the PO lines table and I want to pull the corresponding receipt date for the particular PO/position(s). Currently in the script I have in my where statement to use the user input values as the to and from ranges, but if I add other specifics in the where it's like the report script is ignoring it and only processes the code containing the user input. It does not pull in the receipt date either. That field on the report is blank. Before I added code to use user input from the form, I had the code setup like a simple join between the two tables and that wouldn't work right either. If you use user input are you not able to use other specifics like if I only wanted records that had inpsection flag set to 'yes'?

en@frrom
26th June 2008, 11:31
I suggest that you post your script(s) on here, like this it will be easier to assist you. Just one thought for the moment: did you declare those additional variables as 'extern' in your program script? This is necessary if you want them to be available on the report...

Regards,
Eli Nager

shywanna
26th June 2008, 16:13
Yes I did. Here is my coode:

table ttdpur041
table ttdpur045

extern domain tcdate ddtb.f
extern domain tcdate ddtb.f
extern domain tcorno orno.f
extern domain tcorno orno.t
extern domain tcsuno suno.f
extern domain tcsuno suno.t


detail.1:
before.layout:

select
tdpur041.orno, tdpur041.pono, tdpur041.item, tdpur041.suno, tdpur041.odat,
tdpur041.oqua, tdpur041.qual, tdpur041.quap, tdpur041.quad, tdpur045.date
from
tdpur041,
tdpur045
where
tdpur041.qual = 1
and tdpur045.srnb > 0
and (tdpur041.orno inrange :orno.f and :orno.t
and tdpur041.ddta inrange :ddtb.f and :ddtb.t
and tdpur041.suno inrange :suno.f and :suno.t)
and tdpur041.orno = tdpur045.orno
and tdpur041.pono = tdpur045.pono
selectdo
rprt_send()
endselect

mark_h
26th June 2008, 16:22
Did you also declare them as report input fields?

shywanna
26th June 2008, 16:55
Yep. All the items in the select are included as report inputs.

mark_h
26th June 2008, 19:09
I just noticed - why the rprt_send in the report script? If finding information in a report script you do not need to send the data it will be available. If you actually want to find and print several records then you use layout again. In this case are you finding one or multiple records? If mutliple records I would include a layout for the fields and then use layout.again() to print each record.

shywanna
26th June 2008, 19:25
I really am just trying to do this by looking at some examples we already have in production. I have not had any formal training in this type of coding. I am returning multiple records. I will try layout.again(). Thanks.

mark_h
26th June 2008, 20:58
No problem - sometimes we have to ask a lot of questions to figure out what a poster is trying to do. In this case searching on layout.again should return several useful threads.

rrankinmba
26th June 2008, 21:05
Why are you using the report script? Are you trying to change a standard Baan report and don't have the source code? If so do you want to change the records that the standard report has selected?

shywanna
26th June 2008, 21:23
Yes I want different records than what the standard has.

shywanna
26th June 2008, 21:26
The report has all the records I need, however, like I stated in the initial message, in the where it seems like the other specifications are being ignored and the only code that is being processed is the input from the user. It still gives me records where qual is 2 when I only want qual = 1. The join doesn't seem to work. The report is not pulling in the receipt date from the other table.

mark_h
26th June 2008, 22:07
Something to keep in mind - if you are passing tdpur041 fields into the report and then do a query you could be over writing some of those fields. Put the report in debug mode and step through that query. That query should return all tdpur041.qual's equal to 1(tcyesno.yes) and all receipts > that the sequence 0. The only limiters are the input ranges - there should not be any tdpur041.qual values of 2 - from this query and I do not know what else gets passed into the report.

Actually in somecases you might just want to design a new session and report. I do not know what the original report did, but why not just use this query posted as the basis for a new session(rather than try to change a standard). That would actually probably be better.

shywanna
26th June 2008, 23:37
Ok that helped. I took out that select and just put in a query that looks at the date and then if po and line match from my input fields it grabs the receipt date. Thanks for your help!

rrankinmba
27th June 2008, 20:41
You can chose what records are printed by being sure that your query returns the values that satisfy the layouts output expression.

select *
from tdpur041, tdpur045
where tdpur041.qual = 1
and tdpur045.srnb > 0
...
selectdo
line = 0
endselect