Apologies if this turns out to be appallingly easy, it’s just that I have no luck coming up with accurate keywords and have spent days turning up nothing useful. And if it doesn’t turn out to be easy or even feasible, well, that explains that.
I have ‘FormB’ that can only be created from within ‘FormA’. Any number of 'FormB’s can be created, as required. Each FormB is stamped with FormA’s UNID as FormB.ParentUNID.
A Lookup view categorizes all FormBs by ParentUNID.
Page numbering is not an issue until the moment that the entire package, FormA plus all related FormBs, are actually Printed. At the moment, all documents are frozen; everything is set in stone, no editing changes are permitted. What I am looking for is a way to have the page number of each FormB reflect NOT necessarily in the order they were created, but in the order they appear in the LookupView.
Part of the “Freeze!” process includes an agent that opens up FormA and each FormB in turn, does a fast recalc on the open document, then prints and sets the flag to not permit further editing. What I would really like to have this agent do while it has each FormB open is: return a text list of all the FormB NotesIDs associated with the current ParentUNID, take the current NotesID and search the text string, and if it finds a matching, return the element POSITION. In @formula would be very nice, but I’ll take what I can get. The element Position beomes that FormB’s Page Number.
Is this possible in @formula at all, or am I missing something completely?
Subject: Determining Page Number from @lookup?
What do you mean by Page Number?
When I think page number, I think when I print something and it goes onto a second piece of paper (or second side) that is page 2.
Reading you description it sounds like Page 2 maybe the second document, and page 3 the third? Is that what you mean?
Subject: RE: Determining Page Number from @lookup?
In this instance, I’m actually talking about a pseudo-page number, really. It’s just a computed field on each FormB that, along with a computed lookup field that retrieves the total number of FormB for that ParentUNID, produces a ‘tag’ at the top of each page ‘Page x of X’. X being the total # of FormBs, x being the order that the specific FormB was in the lookup.
At the risk of providing unnecessary information, the computation REALLY is Page (x+4) of (X+4), since FormA constitutes the first four pages of the print package.
Subject: RE: Determining Page Number from @lookup?
Page X of Y
X = The Nth Form B of Form A.
Y = The number of Form B’s for Form A.
Still not a 100% sure what you mean by “being the order that the specific FormB was in the lookup.”
As a look-up or view could be in ANY order.
I would create a hidden view (system use only - not the user).
Selection Formula: Only include FormB documents
First column would be DocID from FormA, sorted accending.
Second column would be Creation Date sorted accending (I’m using this to determine the “position” Form B is in)
Then to get the value of Y - you can do a @DBLookUp on the view searching for the DOCID of FormA, return the DOCID of Form B.
The Number of Elements = The number of Form B’s for Form A.
The loop through the elements getting the DOCID for FormB.
So something like this (typing off the top of my head - so there maybe syntax errors);
key := FormAUNID;
list := @DbLookup( “”:“NoCache”;“”:“”;“(HiddenView)”;key;“DocBUNID”);
Y := @Elements(list);
@For(x := 1; x <= Y; x := x + 1;
@SetDocField( list[x]; "PageNumField"; Cstr(X) + " of " + Cstr(Y) )
);
Hope that helps? Correct my code an post you solution incase anyone else ever wants to do the samething.
Subject: RE: Determining Page Number from @lookup?
I see one mistake clearly @Text() instead of CStr( ). Too much Lotus Script these days.
Subject: RE: Determining Page Number from @lookup?
Yes, yes, I believe you understand exactly what I’m looking to do. I’m returning a @DBlookup of all the FormB DOCIDs into computed field. If the currect FormB’s DOCID is the third element in that text list, then the Page Number is 3 (or Page 3+4, as the case may be).
The only difference is that I could never seem to get that loop to work correctly. I’ll try your construct, thanks!!