×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

(OP)
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

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

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

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

Here is the dialogue I mentioned in my previous post:




Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

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

(OP)
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.

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

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

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

(OP)
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


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

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

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

(OP)
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 ... ).

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

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

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

(OP)
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.

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

(OP)
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.



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


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

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

Quote (mjcmkrsr )

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

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

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

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

(OP)
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.

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

Hi Mike,

Quote:


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.

Quote:


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

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

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

Quote:

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.

https://www.codemag.com/article/0404042/The-Visual...

okarl



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

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

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

Quote:

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

That's fine, Mark. Thanks.

Regarding your point about SELECT ... NOWAIT, I didn't know that was possible. When I saw it in MajklPan's code and your reply, my first thought was that it was a recipe for disaster. I assumed it meant that the code following the SELECT would be executed while the SELECT was still running.

But I realise now that the NOWAIT applies, not to the SELECT itself, but to the Browse window that is automatically opened when you do a SELECT without an INTO clause. Personally I would never do that, but I can see the point of it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

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

And if I remember it correctly, there is no need to have an index for every order/group in a report

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

(OP)
mJinderova:

YES !! This is exactly what I needed, so where did you make the change?
Only in that "Group 1 header: file"? I compare these two documents in vain and find no difference :D
I will also need to make these changes for h_zdvih

Anyway, thank you very much, it will help us a lot in the company and we don't have to do thousands of data individually.

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

The fastest solution( workable, but not permanent ) goes to mJindrova
And the safer (not integrated) goes to Mark,
The match ended in a draw !! thumbsup2

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

(OP)
Yes, thank you very much for your time smile

I still need to know how mJindrova achieved this, as I need to change it for one more .frx file.thumbsup2

EDIT:
I'm sorry, I didn't notice the message, mJindra already wrote it on the mountain and I already solved it wink
mJindrova: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.

So the problem is solved and thanks to everyone for participating :)

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

(OP)
Hello experts, I would like to respond to this topic again.
In the past, I addressed the issue of printing to a new page, and you gave me perfect advice that works. However, there is still a problem: if I change the "Evaluated Value" field (marked in the picture) and print the protocol, it produces some value output after each page with zeros (see picture) that I do not want on that page.

I have been thinking about it for a while, and I cannot figure out where the problem is. It is likely some minor issue with the page settings, but unfortunately, I am not proficient in this area. Would anyone know where to fix this issue?

Thank you for your advice.

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

Try this:

Go to the field properties for the relevant field. On the Format page of the properties dialogue, tick "Blank if zero", then OK.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

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

(OP)
Thanks Mike Lewis:
I have a "Blank if zero" setting here, but I didn't find it here. (So if I'm right where I want to change it)

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

You need to click the "Numeric" option (just below the box where you enter the format expression).

(I'm assuming this is a numeric field. Is that correct?)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

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

(OP)
Oh, I didn't think of that.
So I changed it for each element, but that page is still displayed. (see image)
I also need to have 0 elements displayed in the "zdvih trol.vodice" field

thank you for the advice

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close