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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FoxPro 9.0 - splitting the data into a new page for printing 1

Status
Not open for further replies.

MajklPan

Programmer
Jan 11, 2023
74
CZ
Hi,

I need help with this programming language.

I need advice if anyone knows how I should implement with the incoming data (which is in the file "zdvih.txt") so that the program splits the file names on a new page. E.g. how in the file "zdvih.txt" is the name "Nedakonice-1k-smer-MoravskyPisek-StareMestouUhHrad" so that this data is on one page and as soon as there is a new section "Nedakonice-StareMestouUhHrad-1k" so that the data is already on the next page.
I am attaching the project below.
Unfortunately, I am not familiar with these databases at all, but I believe that it will not be difficult to quickly solve this problem with some command. Unfortunately, I really have no idea how, there is also a pdf file in the attachment and they are color coded. It should already be marked yellow on the next page with the required section and so on.
Note: the "zdvih.txt" file must be in the users/Reports file

I tried commands like NEWPAGE or SectionName.NewPage = .T. , but without result.
I hope I explained it clearly.

Thank you for your help and answer
 
 https://files.engineering.com/getfile.aspx?folder=f87f96d1-7ea8-4891-82c6-9d486525ebfe&file=Zdvih.zip
Welcome to the forum.

It's not clear from your question what the criterion is for breaking the page. I assume that you are using the VFP report designer to produce the report. If so, the report presumably has some data grouping: this shows up in the report designer as "Group Header 1" and "Group Footer 1".

Assuming you have that, to force a page break on a change of group, right click in the group header band, and select Data Grouping. Under "Group starts on" select "New page".

I don't know if this will help. You say you are not familiar with "these databases". That suggests a basic misunderstanding on your part. This is a programming / reporting issue, and is not directly related to databases.

If this doesn't answer your question, please try to explain it more clearly.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Here is the dialogue I mentioned in my previous post:


report_designer_vd325l.jpg


Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you.
I am sorry for my English. I'll try to explain it one more time.

I would like the values marked in the image on the new page of the pdf file.
Once again, I am attaching "zdvich.zip", the previous one was somehow broken.
Try opening it in FOXPro and generating a pdf file.

I tried your procedure and didn't see any difference.

Thank you for answer.
Ahoj_f1fkmm.png

ahoj2_yljnoi.png
 
 https://files.engineering.com/getfile.aspx?folder=71f3a511-de6d-434c-82f8-f5e6ef01f837&file=Zdvih.zip
Hi MajklPan

Not 100% sure, but because the field is a c-120 in size and it's values are very similar... It could be failing when grouping/ordering , I saw this issue a "few" times.

So try to make an index of the cursor by that field
CREATE CURSOR zdvih ( soubor c(120), tp c(6) ............
INDEX ON soubor TAG soubor

Please let us know if that fix the problem

okarl
 
Hi okarl

thanks for the advice, I wrote it the way you wrote it. (see picture 1)
Unfortunately it didn't solve my problem.

I would need the number 000107 to be already on the new page with the required section. (see picture 2)

Thank you for your help

INDEX_nuwhbz.png

inde2_xw7sfm.png
 
MajklPan

In this picture, there is no change in "soubor" field, so ...
Which field do you want to start a new page when the value changes ?

In the Group Screen select ( at the left) the name of that field
An index on that new field might not be required in case is numeric / or short enough.
HTH
okarl
 
Ah, sorry, I don't really understand this environment, but I have to solve it.
As in the picture, number 2. I would like to change the name of the section (as stated in the file "zdvih.txt"), so that it is printed on the next page, nothing more.
The values are correct, everything works, I just want to write the values on the next page when changing the section ( Nedakonice-stareMesto ... ).
 
Hi,

the problem not in spousteci_program.prg but in form.

You have four buttons on form (Náhled, Tisk, Tisk PDF, Tisk DOC).
Each button prepare data in Click() event.
You must create index after line which begin "SELECT * FROM ZdvihSel":

SELECT * FROM ZdvihSel INTO CURSOR ZdvihSel READWRITE NOWAIT
INDEX ON soubor TAG soubor

Your example is simply, but not run able.

Don't forgot so you have two reports (zdvih in ctech language and h_zdvih in hungary language) and "group start on new page" must be for both reports.



mJindrova
 
Yes, as you write, the form contains 4 buttons.
So for all these buttons, I inserted the index and ran, but again nothing changed. I don't know what I'm doing wrong now.
In the attachment, I am sending the entire project, as it works.
Note: "zdvih.txt" must be located in C:\Users\<NAMEPC>\Reports

For Hungarian and Czech, I set "Group Header 1: file" group start on new page in .frx. If I understood correctly.

Thanks for your advice.
pdf_s34rf8.png

 
 https://files.engineering.com/getfile.aspx?folder=ae2d2800-c7a9-4888-af0f-e55abb46c9b7&file=zdvih_OK.zip
Not so completely, I would need it, so that after each end the numbers of that section are on a new page, I marked it in color in the pdf file. (attachment)
If I edit the "zdvih.txt" file manually according to each section, this is exactly how I would like the program to do it and sort it out by itself.

2_wcnu2g.png

1_dcdnwd.png

 
 https://files.engineering.com/getfile.aspx?folder=cbbc34c0-2a7e-4d90-8286-c6c2679fe93b&file=zdvih.pdf

The problem is in report too.
You create new cursor ZdvihSel for report, but group expression is zdvih.soubor - alias.field.
It's a simple, modify group expression to soubor.



mJindrova
 
mjcmkrsr said:
Please be also aware that the field for the IDX index file may not be longer than 100 C (please see the Help file)

It's CDX in the case (limit is 240 bytes for collate MACHINE and 120 bytes for other collates)

mJindrova
 
Mark,

You said, "You may not INDEX ON ... TAG ... while using a cursor". I don't think that's right. Given that you can also index free tables, a DBC won't be necessary. You're right that it would need a CDX, but that would be created on the fly and deleted when the cursor is closed.

Also, "Furthermore you'll have to set ORDER to ... after indexing." I think that creating an index automatically sets the current order to that index.

But your other points are valid, especially regarding the use of NOWAIT with SELECT.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I don't understand that at all :D
I had no idea it was so complicated, just split the data into another page using a rename.
Sorry, I'm an amateur at this.
 
Hi Mike,

You said, "You may not INDEX ON ... TAG ... while using a cursor". I don't think that's right. Given that you can also index free tables, a DBC won't be necessary. You're right that it would need a CDX, but that would be created on the fly and deleted when the cursor is closed.

Also, "Furthermore you'll have to set ORDER to ... after indexing." I think that creating an index automatically sets the current order to that index.

You're twice right - that's why I deleted my answer

MarK
 
There is something more over the case, but I didn't want to complicate things to the user...

When loading the Data Environment from another report, all the code and members of the original Data Environment are copied into the new report. This means any changes made to the original report's Data Environment after the fact are not propagated into reports created from the original report.


okarl
 
Hi,

I checked the data in the "zdvih.txt" file. It contains empty records. I deleted them and tested with a report. It works.

Code:
CREATE CURSOR zdvih (soubor c(120), tp c(6), vyska_MP n(4), rychlost_MP n(4), vyska_NP n(4), rychlost_NP n(4), zdvih n(3))
APPEND FROM "zdvih.txt" DELIMITED WITH TAB
DELETE for EMPTY(Sobour)
SET DELETED ON
BROWSE
CREATE REPORT Soubor

*** Now fill in the fields and the group(s) and preview - it should work

USE

hth

MarK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top