Alpha Video Training
Results 1 to 15 of 15

Thread: Print current runs query

  1. #1
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default Print current runs query

    I have a form PO with a button, Print. The on push is to print the current record. The current index is PO number. When I press the button to print current I would think A5 would use the index for PO number to find the current. It always wants to run a query which takes time. Does anyone know how to print current and make it locate the current record immediately?

    Thanks
    Russ

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Print current runs query

    Russ,

    Need more details.

    Are you trying to print the form, filtered to the current record?


    or


    Are you trying to print a report, filtered to the current record?


    -- tom

  3. #3
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Print current runs query

    Russ,

    I experimented with the action scripts to print the current record using the form layout.

    The 'print current record' action script runs a query on the table to filter out all records but those which match the current record number. You can see this if you 'view' the xbasic 'behind' the action statement.

    You might get faster results if you choose the option to select records at print time based on the value in a control on your form, after first verifying that you have an index in place based on that same field. This should permit LQO to kick in, alleviating the necessity of running a query.

    -- tom

  4. #4
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Print current runs query

    Thanks Tom,
    That's what I was trying to do when I got the anomaly shown in my other post. Perhaps I am misunderstanding what this choice does when used in the context of a button on a form. Maybe this will only work when used with record selection from the report. If thats the case it would explain why A5 shows the wrong set to select a field from as it has no way of knowing what set I would want so it just shows something probably the first set in some order A5 has. I will try to do this as you recommend from the report record selection.

    Russ

  5. #5
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Print current runs query

    What I am trying to do is print a report consisting of the current record only. In Alpha 4 I can set an index, select an index key and the report prints instantly. In Alpha 5v5 it seems to want to run a query, without LQO no matter how I set it up.
    For example the attached screenshot and the next on show a query and how the report is set up to use it. Since there is an index on PO number the report should be able to use LQO but it does not. If I run the query standalone (from the control panel), it does use LQO.
    So, the problem appears to be that the query will run "fast" (with LQO) from the control panel, but the same query run from a button, will not use LQO.
    I certainly would not go back to A4, but it does do some things faster or simpler.
    I would assume I could use xbasic to do this and get it to run with LQO, but the point is that this should be the same with Action Scripting.

    Thanks for the reply,
    Russ

  6. #6
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Print current runs query

    and the query

  7. #7
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Print current runs query

    Russ,

    It's difficult to troubleshoot someone else's app on my best day. Working with screen shots it's virtually impossible. If you furnish a test kit maybe we could explore the issue together more effectively.

    The screen shot suggests you telling Alpha Five to run a saved query, and your message says you don't want the query to run. Color me confused.

    -- tom

  8. #8
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Print current runs query

    Sorry about that Tom,
    I've tried it so many ways I think my messages are reflecting different parts of what I have tried.
    Let me try to make it simpler (or at least coherent)
    1. When I run a query from the control panel it runs with LQO.
    When I run the same query from a button on a form it is not optimized with LQO.

    2. It appears that using a query to find (for a report etc) 1 record is not efficient. It works but in A4 it is much quicker using an index and specifying a key value. When I use action scripting and select print current record it takes too much time to "find" the one record with a query. It would appear that using a range would work faster but is a LOT more cumbersome and time consuming. Maybe I'm off base here but I suspect that when the action scripting for this was designed, it was done with a small data set so this lag was not evident. I am using a sample data set of about 70K records, which is only part of the real data. This really slows it down. What I would like to do is set the index and specify a key in A5, but it appears that you can only specify a real key value, not a variable representing a key value. If it is there, then I'm not seeing it and apologize for my stupidity.

    I could put together a data set to show this and post it but it is proprietary data and to show it I would need to post a rather large data set.

    Thanks again
    Russ

  9. #9
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Print current runs query

    Russ,

    Do this to verify that LQO works or does not work.

    Build simple form based on single (large) table.

    Arrange to have the table indexed on a key field, which you display on your form.

    Build a simple report based on the same table, and arrange for it to use 'currently selected records'.

    Drop a button on the form, and program it's OnPush event with an Action Script which:

    Uses the Print a Layout action statement, modified as follows:

    a) Selects records to print, by specifying:
    'Records that match value in a control on the current form'

    b) tells Alpha Five to use the object on the form which displays the key field to compare with the key fields in all the records in the table.

    Doing this will cause Alpha Five to run a query against the table. In my testing here, using a small data set, it happens so fast I can't tell if it's using LQO or not.

    If you find that it does not, then I would venture to say that the query filter expression developed by the action script differs slightly from the expression we're using in our index. If the delay is bothersome, you will probably have to tweak the code generated by the action script.

    -- tom

  10. #10
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Print current runs query

    Now this is getting weirder.
    I installed my current build on the network and optimized. The client machine in this case is an AMD 450 with 256 meg ram (I think).
    A5 runs really slowly on this machine. I was showing a user how to do some things on this machine and I ran the report that requires the query. I told her this will take a while but I am working on it. To my amazement the report (and the query) appeared to run very fast. It appeared to me that LQO was being used. Well, I figured I must be mistaken, and that it was actually using LQO after all. When I got home I tried it on my development maching. Running it from the button caused the records processed to be shown on the status bar which to me indicates that LQO is not being used. Then I tried running this from the control panel. From there it ran very fast with a blue bar to indicate progress, to me indicating use of LQO. I can't explain this. I will have to look further at it on the network to see if I can figure this out but probably not until after the conference as real work intrudes.
    I will try your procedure when I can, and I appreciate the time you have put into this. A5 does do some strange things at times.

    Thanks
    Russ

  11. #11
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default RE: Print current runs query

    Russ,

    I didn't read this whole thread in detail but in the past I have found this method to speed up certain reports by factors of as much as 20:1. (I must admit, this was in v4 and I haven't tested yet in v5.)

    - Before printing, LOAD (don't Open) a form which uses the same set as the report.
    - Run a query on the form. This query should only filter based on the parent table and preferably on indexed fields.
    - Print the report... Report settings must be "based on existing records" and you should pass any additional filtering via the report 'print' command. In XBasic for this would be: Report.preview("RptName",FilterStr,OrderStr)
    - Set the form loaded previously to "Show_all" and close it. (The form should have been Loaded but never shown. Setting it to Show_all makes sure the next user doesn't open a form with a strange query showing.)

  12. #12
    "Certified" Alphaholic
    Real Name
    Russ Boehle
    Join Date
    Mar 2000
    Location
    Connecticut
    Posts
    2,767

    Default RE: Print current runs query

    Thanks Cal,
    I'll try your suggestions, but probably not until after the conference. See you there.Seems like A5 has made some things from A4 harder and slower. Oh well, there are always tradeoffs!

    Russ

  13. #13
    Amir Bienstock
    Guest

    Default RE: Print current runs query

    I also wonder why it would be so hard to print a report JUST for the current record. A4 had a button genie that took care of that. Can't find it in A5.

    Any code that needs to be written?

  14. #14
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Print current runs query

    Amir,

    One approach is to drop a button on a form that's based on the same table or set as the report. Make it a custom button, using action scripting. You'll find the Action of printing current record in the Category for Reports.

    You'll find this gives you more options with the current record than were available before. If you only need to print or preview the report and you always want the range of records limited to the current record, I think it can be done with a single line of xbasic code, or a simple action statement or two. Let me know if you need example.

    -- tom

  15. #15
    Amir Bienstock
    Guest

    Default RE: Print current runs query

    Thanks Tom. I managed to set up the button using your suggestion, modifying the code, somewhat. I'm not very Xbasic savvy, but I can manage by plagiarazing existing code.

    Amir

Similar Threads

  1. Print Current Record
    By debwelch in forum Alpha Five Version 6
    Replies: 0
    Last Post: 01-20-2005, 09:51 AM
  2. Print Current Record
    By Mortie in forum Alpha Five Version 5
    Replies: 0
    Last Post: 05-13-2004, 01:43 PM
  3. Query Runs Twice Why ?
    By Gary Phillips in forum Alpha Five Version 5
    Replies: 6
    Last Post: 08-07-2003, 07:51 AM
  4. Print Current Record
    By Phil Rolf in forum Alpha Five Version 5
    Replies: 13
    Last Post: 02-09-2003, 04:29 AM
  5. hard drive runs and runs
    By Kurt Neuswanger in forum Alpha Four Version 6 and Prior
    Replies: 2
    Last Post: 05-25-2000, 12:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •