radio9001
1st June 2023, 09:41
Hello,

I think I have a very simple problem, in the print session I created a new yes/no field in extension.
This field is sent to the report ( added in the input fields report) , then the corresponding fields show some section on the report layout.

However, there is a problem with this solution.
If we save in the personalization of the printing session, marking this field yes/no to yes, the system does not refresh itself what selection this field has and does not send it to the report.

Currently downloading the field I had in the section "when the field changes"

Please give me a hint, on where to put this because I already probed a lot of different options, but it does not work out.

OmeLuuk
1st June 2023, 17:33
So you are basically saying that your extension fields are not stored in the "Save Defaults" for the session? Not sure if that is the case, others can reply on that.

An - old time - alternative in such cases is the use of a global variable as a form field. This global variable "string procesinfo$(200)" can be used in your case.

Just add a part of this string as a formfield (procesinfo$(1;5)) for the first variable and another part for the second variable (procesinfo$(10;5)).

These (parts of the) variable can be used in the report script or in print conditions.

radio9001
5th June 2023, 08:44
Hi ,

Do you have an example somewhere , how to perform it?
It needs tcyesno field , to mark it in the printing session.
Your global variable is a string , so that probably won't help , or do you have a workaround for that ?

BR

OmeLuuk
7th June 2023, 12:44
Disclaimer: have not used this in an Ext setting, but in theory should be similar as what I did.

Take standard session whinh3412m000,
Added formfield (in at that time dynamic form editor)
Field Name: procesinfo$
{Note: in your case you will need two fields, take enough space for your enums and use the same variable like procesinfo$(1;99) and procesinfo$(100;199)}
Field Type: Input
Domain: whadd.cost.rec

In the report script:before.program:
import("procesinfo$", procesinfo$)
if lval(procesinfo$) = etol(whadd.cost.rec.automatic) then
| From the table whsun915 retry all records with a status other than
| processed (thus: failed for some reason before).
main.line = 1
select whsun915.*, whinh312.*
from whsun915, whinh312
where whsun915.stat <> whsun.gig.stat.004.processed
and whinh312.rcno = whsun915.rcno
and whinh312.rcln = whsun915.rcln
and whinh312.item = whsun915.item
order by whsun915._index3
as prepared set
hint use index 3 on whsun915
selectdo
if r.this.rcno <> whinh312.rcno then
r.s.before.whinh312.rcno()
r.this.rcno = whinh312.rcno
endif
r.10.s.detail()
r.15.s.detail()
r.40.s.detail()
endselect
r.s.after.program()
spool.close()
r.fp = get.pgrp(pid)
kill.pgrp(r.fp)
endifWhich added a full automatic retry option to resend failed Receipt Lines to our WMS based on a custom table using this report (specific sections).

But also other things can be done with this parameter like suppress output:before.whinh312.rcno.1:
before.layout:
if lval(procesinfo$) <> etol(whadd.cost.rec.no) then
lattr.print = 0 | or change to 1 to print
endif
In your case it would be likedeclaration:
domain tcyesno case.1, case.2
before.program:
import("procesinfo$", procesinfo$)
case.1 = ltoe(lval(procesinfo$(1;99))
case.2 = ltoe(lval(procesinfo$(100;199))Hope this still works / works for you.

Oh, and yes, it is a string, but you can put anything in a string right? And interpret it as a long, enum, whichever you want. The session itself uses it with a domain (and stores the long value in the string variable).