report temp file not found

I need to create a simple report, nothing fancy. Just to preview some memo fields.

This is the code I use.

lcFile = "C:\VFP_Projects\Reports\MyReport.FRX"
SET DIRECTORY TO "C:\VFP_Projects\TEMPORARYFILES\"
CREATE REPORT (lcFile) FROM (ALIAS()) FIELDS memo1

The second line (set directory to) should be explained. I get an error that a temp file c:\\VFP_Projects\Data\...\000035e10062.tmp no found. Options are "Locate," "Ignore," "Cancel," etc. Naturally the file name changes every time I try to create a report. Thus the name above does not mean anything. The error messages comes up every time no matter what. In an attempt to resolve it I tried to point FoxPro to the directory of temporary files where a bunch of such files is located. No avail.

I have't seen any report so far. I feel like I am just beginning to do VFP 5 nonths ago. Clueless.

Thanks.




Answer this question

report temp file not found

  • SSotnikov

    It seems I solved it. Thank you very much. I still do not quite understand why what I did resolved the problem but briefly, I had to put a statement:

    SELECT tCursor

    RIGHT before the REPORT FORM command. I do not know why it made all the difference. Definitely your post inspired me to look for options because it set up certain boundaries. I thought to myself: it should be simple, it is around the corner and I am about to fix it.

    I came to this idea by examining the ALIAS() statement result in the command window after one of the break-ups. The ALIAS was not tCursor but the original cAlias of the source table. I do not understand why. There is another statement SELECT tCursor a few statements before. I thought it was a sufficient guarrantee. Somehow it switched back to the other one. I also simplified the code, excluded the mentioning of memo1 from CREATE REPORT command--it did not help though.

    The "report" still looks bizarre, wrongly formatted, the text width is just one word so it is a long column of single words but everything seems to be there, teh whole memo1 field.

    Thank you very much. This is the code:

    cAlias = findCAlias (letter)

    SELECT &cAlias

    SELECT memo1 FROM &cAlias WHERE numeric_id = tagged INTO CURSOR tCursor NOFILTER READWRITE

    SELECT tCursor

    lcFile = "C:\VFP_Projects\Reports\MyReport.FRX"

    IF NOT EMPTY(lcFile)

    CREATE REPORT (lcFile) FROM tCursor

    ENDIF

    lcCurDir = FULLPATH( CURDIR())

    SET DEFAULT TO "C:\VFP_Projects\Reports\"

    SELECT tCursor <<------------- The resolution was here

    REPORT FORM MyReport.FRX PREVIEW

    SET DEFAULT TO (lcCurDir)



  • Dundee

    >> At the same time since I am dealing with REAL tables the issues you've covered seem to be moot. They do not apply. Wrong

    No, that is perfectly correct. But the error you are seeing is a reference to a temporary table

    >> c:\\VFP_Projects\Data\...\000035e10062.tmp no found

    Is obviously a temporary table. So SOMETHING in your code is referencing this temporary table.

    The usual issue is, as I suggested, an SQL SELECT into a cursor that is missing the NOFILTER clause. VFP will, in the absence of explicit instructions to the contrary, try to optimize a fully optimizable query by creating a filtered view. This can appear to be a cursor, but there is no physical file underlying it, and that is the usual cause of the error you are seeing. The solution is to add the NOFILTER clause to the SQL query that creates this temporary table (whatever it is).

    SELECT * FROM myTable INTO CURSOR temp NOFILTER

    Without seeing your code, it is hard to say where the reference is being made (could it be an alias in a report field ).



  • Russt

    >> Thus the previous post on the subject "variable memo1 not found" remains unanswered

    The only other thing I can suggest is to check the report property settings. Maybe it is using (or not using) its own data environment and data session.

    If you now have it in the right directory then the only reason for that error is that the field with that name is not being found. Either:

    The table is not open in the report's datasession

    The field is not named correctly (unlikely since you are creating the report)

    The report settings are set to automatically add the ALIAS to the field name and the alias name is changing

    Lots of others but the all relate to the same thing - the environment when the report runs is not compatible with the settings in the report - hence the error. Not much help I know, but I can't think of anything else specific



  • Nose

    Reports are not my thing I am afraid. But I am guessing that the reason this is happening is that the CREATE REPORT FROM command is using the settings from the first record to size the output fields. (This would be normal VFP behavior under these situations). So if fields in other records contain more data than the first, you would see exactly what you describe.

    One solution, as suggested by Tamar, is to create a standard report layout that contains only column names (no alias), does not open any tables and does not use its own data session. Then all you have to do is to populate a cursor with appropriate column names and call the report.

    That way you could format things exactly as you want them, change fonts and sizes and so on just once!

    The alternative would be to hack the created FRX file (a report definition is just a DBF file with a different extension) and the details of what gets stored in which fields are in the "\Tools\FileSpecs" folder under the VFP home directory.

    However, this is not a job for the faint-hearted and I, for one, would much rather use a standard report. From what you describe it would be pretty simple and shouldn't take more than a few minutes to create anyway.



  • Shailesh Namjoshi

    REPORT FROM command is using the settings from the first record to size the output fields

    That must be it. The default width of a memo fields is 75! My visual estimation was 80! This is the only field in the cursor at this point.

    Thank you. You've suggested a number of interesting possibilities.



  • msdnmonk

    Many, many thanks, Andy.

  • Cagdas Top

    How can I change the column width in the report I mean, I followed all protocols and discovered that the default column width is set up to 8 1/2 inches. But that is apparently related to paper output. I am not there yet.

    At this point I am eyeing a preview form which I generate with REPORT FORM command and what I see is not very pleasant. All output is arranged in one column and it is very narrow. Perhaps about 80 in VFP form metrics. It has a place for just one word (barely). Sometimes only a fraction of a word is on one line and the rest of it is carried over to the next where it occupies the whole line (sometimes just one letter remaining). It is very bizarre.

    Also only the first couple of sentences could be seen, not the whole memo field.

    It looks like the width of this column should be controlled somewhere. Also I prefer to set this property value programmatically. Can it be done

    Thanks.



  • aconi

    Is there a reason you need to create the report programmatically It would be much easier for you to design the report to look as you need. Just issue CREATE REPORT from the Command Window, set up the report the way you want it and save it.

    Tamar

  • SteZgr

    I am very sorry but the problems still continue. I haven't had time to get back to the subject until a few minutes ago and when I actually tried modifications you've suggested the following things transpired:

    (1) the ALIAS () is actually a table, meaning it is an open table. It is also fairly large by my standards, about 7,000 records or so. It is definitely on a HD. It has been there for ten years growing slowly--the first incarnation was in dBase. It is also dynamically changing table(s), this is why I use the ALIAS() clause. There are about 12 of them on HD. I want this statement to be universal for any ALIAS().

    (2) With the DBF (ALIAS()) I got the same error message as without it.

    (3) The NOFILTER clause did not do me any good either. First I do not understand where it should be put in in my situation. When I tried it at CREATE REPORT I got an error message. There is no other place for it to go. I remember seeing it in help many times but it is absent there as a separate heading and it is not indexed. I could not read anything on it.

    At the same time since I am dealing with REAL tables the issues you've covered seem to be moot. They do not apply. Wrong

    Need help still.

    Thanks.



  • Mario_G

    >.The second line (set directory to) should be explained. I get an error that a temp file c:\\VFP_Projects\Data\...\000035e10062.tmp no found

    Looks like the currently selected alias (referenced by the call to the ALIAS() function) is a cursor that is actually a filtered view of the underlying table (or possibly so small that it is held totally in memory and the disk file - which is what the reference is to - was not created).

    To avoid this situation, use the NOFILTER clause to force the disk file to be created (see Help file for details) in your query that creates the cursor.

    Also, more generally, you should be careful using ALIAS() when referencing the file (as opposed to an open table alias). Better to use DBF( ALIAS() ) which returnes the fully qualified path and file name of the specified VFP Alias. It is true that, by default, the ALIAS and the DBF stem are the same, but that is not necessarily true in all cases.



  • DeeD

    Whaps!!! I have been using SET DIRECTORY TO for months and never gotten an error message I think. It is a Visual dBase command. I never realized that it had no place in VFP! Now certain things are making sence. At times I would use it and the file still would be unaccounted for but I never inquired. I would change it to SET PATH TO and proceed with the code.

    Thank you very much. It is useful to post your code.



  • Klenne

    OK, I am making an incremental progress and it makes me feel better. After I started creating an intermediate cursor just to satisfy the NOFILTER requirement the message demanding that temporary file has disappeared and the CREATE REPORT statement now executes. Immediately I ran into other problems.

    This is how my code lines are arranged now:

    SELECT &cAlias
    ACTIVATE SCREEN
    ALIAS()
    SELECT numeric_id, memo1 FROM &cAlias WHERE numeric_id = tagged INTO CURSOR tCursor NOFILTER READWRITE
    SELECT tCursor

    "COUNT = "+STR(RECCOUNT ())
    lcFile = "C:\VFP_Projects\Reports\MyReport.FRX"
    IF NOT EMPTY(lcFile)
    CREATE REPORT (lcFile) FROM tCursor FIELDS memo1
    ENDIF
    SET DIRECTORY TO "C:\VFP_Projects\Reports\"
    REPORT FORM MyReport.FRX PREVIEW

    Those " " statements are there to verify that the cursor is being created and it has just one record as intended. The printout confirms it. Numeric_id is a character string and memo1 is of type memo. I want to make a report out of memo1.

    At the last statement: REPORT FORM... I get an error message: "Variable memo1 not found."

    I go to the REPORTS directory and find the report file in there. I can see the Page Header with "memo1" inside and Detail with "memo1" likewise on that line and date() in the Page Footer. When I try to run the report it is asking me for a .dbf file and offers a number of prompts. They are some of my essential tables excluding the one from which this report has been supposedly created. I am afraid to use any prompts: you never know what the VFP is going to do with the table I offer it. Maybe it will be screwed up completely plus it does not seem natural what it is doing. It seems I am on the wrong track.

    Thank you.



  • JB17

    Hi Alex

    Progress is good

    >> SET DIRECTORY TO "C:\VFP_Projects\Reports\"

    I think maybe this should be "SET DEFAULT TO....". There is no "set directory" command in VFP.

    For what iot's worth, the way I usually do this is like this:

    lcCurDir = FULLPATH( CURDIR())
    SET DEFAULT TO "C:\VFP_Projects\Reports\"
    *** Code here ***
    SET DEFAULT TO (lcCurDir)

     

     

     

     

     



  • LonelyPixel

    Andy, thank you for clearing up my mind on the set directory issue HOWEVER the correction has not resolved the problem. The progress has stalled

    Thus the previous post on the subject "variable memo1 not found" remains unanswered. Unfortunately I am still trying to tie loose ends in other parts of my now very vast project and I can get back to the REPORT issue only piecemeal. I do not anticipate many difficulties here however. Once this thing is resolved the reports, I think, should start rolling. I do not need hugely elaborate reports anyway.

    Thank you very much.



  • report temp file not found