pbenven
26th February 2011, 15:52
Hello. First post, not a developer and I don't really know what I'm doing. I am persistent, though, and I believe I am very close to achieving the results I am looking for.

The environment is MK 8.1, BISAM database, HP-UX, clients are a mix of Reflection 2 (vt220) and ReflectionX (hpterm).

We do not use the Shop Floor Inspection Report (tisfc040811000) and I am hacking it so that I can produce a list of drawings (tidcs101.draw) that are related to the manufactured item (tisfc001.mitm).

Through various attempts, I have been able to produce a list with the correct quantity of drawings, but the values that appear on the report are repeats of either the first or last record - I can't for the life of me figure out how to print each record before returning to find the next.

Here is my report script - go easy on me:

declaration:

extern domain tcoqan draw.count
extern domain tcitem drawing

header.1:
before.layout:

select count(*):draw.count
from tidcs101
where tidcs101.item = :tisfc001.mitm
selectdo
endselect

detail.1:
before.layout:

select
tidcs101.draw | Drawing
from
tidcs101 | Drawing - Item Relations
where
tidcs101.item = :tisfc001.mitm
selectdo
drawing(draw.count) = tidcs101.draw
endselect


after.layout:

if draw.count > 0 then
draw.count = draw.count - 1
layout.again()
endif

Please help.

bdittmar
26th February 2011, 19:14
Hello. First post, not a developer and I don't really know what I'm doing. I am persistent, though, and I believe I am very close to achieving the results I am looking for.

The environment is MK 8.1, BISAM database, HP-UX, clients are a mix of Reflection 2 (vt220) and ReflectionX (hpterm).

We do not use the Shop Floor Inspection Report (tisfc040811000) and I am hacking it so that I can produce a list of drawings (tidcs101.draw) that are related to the manufactured item (tisfc001.mitm).

Through various attempts, I have been able to produce a list with the correct quantity of drawings, but the values that appear on the report are repeats of either the first or last record - I can't for the life of me figure out how to print each record before returning to find the next.

Here is my report script - go easy on me:

declaration:

extern domain tcoqan draw.count
extern domain tcitem drawing

header.1:
before.layout:

select count(*):draw.count
from tidcs101
where tidcs101.item = :tisfc001.mitm
selectdo
endselect

detail.1:
before.layout:

select
tidcs101.draw | Drawing
from
tidcs101 | Drawing - Item Relations
where
tidcs101.item = :tisfc001.mitm
selectdo
drawing(draw.count) = tidcs101.draw
endselect


after.layout:

if draw.count > 0 then
draw.count = draw.count - 1
layout.again()
endif

Please help.

Hello,

don't know your requirement and your reportlayout well, but:

You only have header and detail ?
No before field?

use a long for counter (tcoqan is double !)

extern domain tcmcs.long draw.count

and in after layout, first do layout.again() an the decrement the counter.

if draw.count > 0 then
layout.again()
draw.count = draw.count - 1
endif

Hope this helps.

But better it should be a report like:

header
before.tisfc001.mitm
before.tidcs101.item
detail
after.tidcs101.item
after.tisfc001.mitm

Regards

pbenven
26th February 2011, 21:00
Bernd,

Many thanks for your help.

When I change the location of the layout.again() line, I am getting the last value in the set of values I am looking for, reprinted for as many rows as there are in the tidcs101 table.

I don't know the first thing regarding the implications of your layout suggestion. The idea for me is to produce a list of drawings associated to the mitm. I will then format them as Code 39 barcodes for calling up visual aid instructions from an external application.

bdittmar
26th February 2011, 22:41
Bernd,

Many thanks for your help.

When I change the location of the layout.again() line, I am getting the last value in the set of values I am looking for, reprinted for as many rows as there are in the tidcs101 table.

I don't know the first thing regarding the implications of your layout suggestion. The idea for me is to produce a list of drawings associated to the mitm. I will then format them as Code 39 barcodes for calling up visual aid instructions from an external application.

Hello,
don't have access to one of my a B IV systems yet, but from memory:
My layout suggestion should represent the flow of your data without need of use a layout.again()

1.)
Use tisfc001.mitm as presorted and tidcs101.item as ascending

2.)
Define a layout as suggested : Header, Before.tisfc001.mitm, Before.tidcs101.item, detail

3.)
in before.tisfc001.mitm do (read the drawing itemcodes):
before.layout:
select tidsc101 ......
from .... where tidcs101.item = :tisfc001.mitm
..........
(So you'll have all drawings in your recordset)

If tidcs101.item is your inputfield, it should be displayed in detail layout as long as tidcs101.item value changes.

If you don't need the layout tisfc001.mitm, supress it with lattr.print = false

e.g.:

before.tisfc001.mitm.1:
before.layout:
select tidsc101.*
from tidcs101
where tidcs101.item = :tisfc001.mitm
selectdo
endselect

lattr.print = false

Same for tidsc101.item !
-----------------------------------
Be sure that lattr.print is placed, after all calculation is done.


Hope this is what you try to achieve.


The standard reports from session tisfc0408.... are following a similar logic.

Regards
Regards

pbenven
26th February 2011, 23:53
Bernd,

You are being most gracious with your time - I am very appreciative. I hope I am not wearing out my welcome.

I have recreated the script based on what I inferred from your suggestions:

header.1:

before.tisfc001.mitm.1:
before.layout:

select tidcs101.*
from tidcs101
where tidcs101.item = :tisfc001.mitm
selectdo
endselect

lattr.print = false

before.tidcs101.item.1:
before.layout:

select tidcs101.*
from tidcs101
where tidcs101.item = :tisfc001.mitm
selectdo
endselect

lattr.print = false

detail.1:

The detail section (in Maintain Layouts) contains only one print expression:

tidcs101.draw

The report produces only the last record of the set I am looking for - it does not print each corresponding tidcs101.draw value.

Again, I am thankful for your help, and especially so on a Saturday.

pbenven
27th February 2011, 05:33
Eureka!

declaration:

long count

header.1:

before.tisfc001.mitm.1:
before.layout:

select count(*):count
from tidcs101
where tidcs101.item = :tisfc001.mitm
selectdo
endselect


before.tidcs101.item.1:
before.layout:

|select tidcs101.*
|from tidcs101
|where tidcs101.item = :tisfc001.mitm
|selectdo
|endselect


detail.1:
before.layout:

select tidcs101.*
from tidcs101
where tidcs101.item = :tisfc001.mitm
order by tidcs101.draw desc
as set with :count rows
selectdo
endselect

after.layout:

count = count -1
if count > 0 then
layout.again()
endif

The "order by", and "with :count rows" along with If statement in the after.layout did it.