monica1
11th January 2005, 10:40
I write a query in before.program and I don't find the error. Can you help me?
before.program:
import("tffas007.fasc", tffas007.fasc)
query = "cafas080.fasc.d, cafas080.amnt, cafas080.date, cafas080.ttyp, cafas080.docn"
query.extend.select(query, EXTEND_APPEND)
query.extend.from("cafas080", EXTEND_APPEND)
if strip$(tffas007.fasc) = "" then
query = "cafas080.fasc.o refers to tffas007 unref CLEARUNREF"
query.extend.where(query)
else
query = "tffas007._index1 = {'" & tffas007.fasc & "'}"
query = query & " and cafas080.fasc.o refers to tffas007 unref CLEARUNREF"
query.extend.where(query)
endif
rebuild.query()
The cafas080 table have the field cafas080.fasc.o in index1 and it's possible to have more than 1 records or 0 in this table for each record in tffas007.
Thank you in advance,
malutz
11th January 2005, 12:16
Hej,
what kind of errormessage do you get?
monica1
11th January 2005, 12:47
The errormessage is: Zero pointer: name ' ' in get_sval
The main table in my session is tfffas007.
Francesco
11th January 2005, 18:01
...but here are a two tips:
1. Lose the EXTEND_APPEND options. They serve no purpose but might cause trouble.
2. Lose the rebuild.query statement. The query is automatically rebuild at the end of the before.program section.
If these don't do the trick, you can try to change your CLEARUNREFs into SKIPs.
monica1
11th January 2005, 18:20
losing the EXTEND_APPEND options and the rebuild.query() the error is missing, but the session don“t work like I want. I expain it:
Example1: In tffas007 I have one record fasc -->REMA99-047
desc --> Description
In cafas080 I haven't record
I wan't a 3rd type screen that in the group section appears REMA99-047 and the description and in the multiple records part is in blank.
Example2: In tffas007 I have the same record and in cafas080 I have 2 records. fasc.o --> REMA99-047
fasc.d --> REMA99-047B
fasc.o --> REMA99-047
fasc.d --> REMA99-047C
I wan't the same but in the multiple records part appears in one line REMA99-047B and in the second line REMA99-047C.
Can you help me?
Francesco
11th January 2005, 20:27
I think you make things overly complicated by using dynamic SQL for this problem.
Why not do this:
before.program:
import("tffas007.fasc", tffas007.fasc)
select cafas080.fasc.d, cafas080.amnt, cafas080.date, cafas080.ttyp, cafas080.docn
from cafas080
where cafas080.fasc.o = :tffas007.fasc
selectdo
| whatever you want to do with your record(s)
my.variable = fasc.d
selectempty
| what to do when there are no matching records
selecterror
| trap errors
endselect
simple and robust :)
gous99
12th January 2005, 13:27
In this part of your code;
else
query = "tffas007._index1 = {'" & tffas007.fasc & "'}"
query = query & " and cafas080.fasc.o refers to tffas007 unref CLEARUNREF"
query.extend.where(query)
You are missing the ":" before your variable tffas007.fasc
monica1
12th January 2005, 13:39
No, I don'`t miss : in the query, because the result of this assignament is:
query = "tffas007._index1 = {' REMA99-047'}"
Andreas
12th January 2005, 19:10
Hi Monica?,
if i understand right you have a display session (type 3) based on tffas007 where you wan't to show fas007 information in Header and Information from cafas080 in the multi occurence area.
In my opinion this will not work if you placed the cafas080 records on the form. Standard program is not able to handle this.
I think it is a multi main table problem (You can do such things in ERP LN).
If you like to do such a program you have to match the cafas080 records to your own array-variables and have to program the behaviour of the occourences by yourself (very tricky).
There is a standard session in Baan that do something similar. Have a look at cprrp0520m000.
Hope this helps,
Andreas