Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counter needed for document names

Status
Not open for further replies.

sb1958

Programmer
Aug 31, 2009
6
US
we have an application that we are wanting to import information in. we are thinking that maybe crystalcan help with the doc names;

the name = 302768 and is 11 pages in length
we want to create a field name that will increment with the number of pages.

302768.001
302768.002
302768.003

I cna create the first one 302768.001 - but how do I loop through 10 more times to create the next 10 documnet names ?

 
This is unclear. Do you want the document name to change based on the pagenumber of the page in which it is displayed? Where are you planning to display this formula--what section?

-LB
 
Sorry if unclear - The Document Name 302768 and is 11 pages in length.

I need the Document Name to appear 302768 and the number of pages - which is 11.
Then under that I need to show ;
302768.001
302768.002
302768.003
302768.004
302768.005
302768.006
302768.007
302768.008
302768.009
302768.010
302768.011



 
I can create the Document Name once - What I need to know is how to create 11 different names.

Crystal is not allowing me to loop through on a formula field, ie. 'counter on the number of pages'.

I thought about a sub-report to produce the name for each page - I am drawing a complete blank ....................

I have reached total burn out and can no longer think
 
You didn't answer my question. Where would these numbered values go--in what report section? Is this ALL you are planning to display or are you really trying to create a table of contents?

-LB
 
The report is sorted by Document Name and shows the following fields in the Header Section
Document Name
Number of Pages

- Detail Section I have a formula that shows the New Document Name ;
docid :=
REPLACE(REPLACE(TOTEXT({?Pm-STATEFUN_NEW.DWDOCID}),",",""),".00","")
+ "." +
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 1 THEN
"00" + REPLACE(TOTEXT({@increment}),".00","")
ELSE
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 2 THEN
"0" + REPLACE(TOTEXT({@increment}),".0","")
ELSE
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 3 THEN
REPLACE(TOTEXT({@increment}),".","")

I got the Document Name to display once - I need it to display based on the Number of pages.

----------------------------------------------------
So I tried a sub-report to show the new document name by the same formula above and added the line shared stringvar docid.

shared stringvar docid;
docid :=
REPLACE(REPLACE(TOTEXT({?Pm-STATEFUN_NEW.DWDOCID}),",",""),".00","")
+ "." +
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 1 THEN
"00" + REPLACE(TOTEXT({@increment}),".00","")
ELSE
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 2 THEN
"0" + REPLACE(TOTEXT({@increment}),".0","")
ELSE
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 3 THEN
REPLACE(TOTEXT({@increment}),".","")

I need to access the sub-report so many times before it reads the next record in the table, the number of times is based on the field Number of Pages.
 
What header section? Report header, group header, page header? And, as I asked before, is this ALL you are planning to display or are you really trying to create a table of contents? Does it matter if the results are all in one detail row but with returns? Or are you trying to get the results in separate detail rows?

Please answer all questions.

-LB
 
What header section? Report header, group header, page header?
ANSWER : Group Header

And, as I asked before, is this ALL you are planning to display or are you really trying to create a table of contents?
ANSWER : That is all I am trying to display

Does it matter if the results are all in one detail row but with returns? Or are you trying to get the results in separate detail rows?
ANSWER : Detail row with returns, I need to be able to drop this into a spreadsheet for the import process on another system.
 
If you are putting this into a spreadsheet, then a formula that returns the values in one detail row with returns, will populate only one cell in Excel. Is that what you want to do?

-LB
 
No, I need it to populate multiple cells.
 
You could do this through a semi-manual process, where you insert the group on document name as many times as the maximum number the page count can be. Then create a formula like this:

whileprintingrecords;
numbervar cnt;
if cnt < totalpagecount then
cnt := cnt + 1;
totext({table.docname},0,"")+"."+totext(cnt,"000")

Place this formula in EACH group header section. Then in the section expert, suppress EACH group header conditionally with a formula, e.g., for GH#3:

totalpagecount < 3

Change the number to correspond to the groupnumber.

This does export correctly.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top