Alpha Video Training
Results 1 to 25 of 25

Thread: Change table element from report

  1. #1
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Change table element from report

    I have been trying to change a field from within a report and this is the second time I have tried to ask how to do it. The report is based upon a set which has a parent and two children tables. I compute a "balance due" from other fields in the report and wish to open one of the tables in this set, replace a value in this table (opening balance) so that the next time this report is run, the opening balance amount will be used to compute the new balance due field (which will again be saved to the table). I remember years ago having to open write and then close the table to do something like this. Does Alpha have an equivalent way to do this. I intend to use code attached to a button on the table which will Print the report. I will use the on push action of this button to store and run the code. Thanks for any help.

  2. #2
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,026

    Default Re: Change table element from report

    You still have to open change and lose the table and can use a button on a form if you wish or do it with xbasic. I believe(not in alpha at the moment) you have a way to do it on after report is run using a script. Willl look when I get back to aa developer to verify I am right. Note: I never had to use it.
    Dave Mason
    dave@aldausa.com
    Skype is dave.mason46

  3. #3
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Change table element from report

    In your report design use the primary key to create a hyperlink in the report to open a form to the record in the table you want to change; make the change, save and close the form.

    Create another form using a report preview supercontrol to display the report. Add a button to that form above the supercontrol that will refresh the report.
    topparent:xdialog1.refresh()

    When you call the report, open the supercontrol form.
    Last edited by MoGrace; 08-02-2019 at 12:34 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  4. #4
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    I had hoped to have this done automatically as there are nearly 200 different reports for different people to be generated each time. So opening a hyperlink and manually making a change for each of them would not be acceptable. I was looking for code that would automatically open, write, and close the table for each instance of the generated report. Is this not possible?

  5. #5
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Change table element from report

    Without more info on the set structure, you leave us only guessing how to help.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  6. #6
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Sorry, thought I had mentioned the set. Parent _ Patients
    Transactions One to many with Patients
    \=Services One to one with Transactions (One service for each Transaction)

    Indexed on Patient ID

  7. #7
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Hope you can see the organization. The board here did not keep my message as it was displayed when I wrote it.

  8. #8
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Should have mentioned that the parent table has the field that I want to update. The field is named "balance due".

  9. #9
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Just inadvertently unsubscribed to this thread by clicking the wrong reply in the email. How do I resubscribe?

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

    Default Re: Change table element from report

    David,

    I would update the "Balance Due" field only after the user approves the printed report(s). The update would be done automatically using a script that replicates the calcs in the report(s).

    I've found overwriting the "balance due" field problematic in my own work. You lose the transaction history and have no easy way to verify the balance due is correct. You might want to create patient_register to record each billable transaction, including date of the report (invoice?), opening balance, new charges or credits, and ending balance (an invoice number if applicable). Transactions in the register would be entered after the user approves the printed reports.

  11. #11
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Tom I have been warned by my partner to do exactly as you suggest. A script sounds the way to do this. Thanks for the warning.

  12. #12
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    I have thought about what you said this morning and realize that we already have a "history" of all transactions (what you call the patient_register) in our table "transactions" which is a day by day history of all transactions sorted by patient number. So, how could I go about actually writing a script to change the balance_due field in the patients table. I tried creating a new script which could change records and it only takes me to a form of the patients table. I am just not sure how to go about this. Any help would be greatly appreciated. Thanks again for your reply.

  13. #13
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Change table element from report

    Is the balance due field only related to a single patient? Ie, one record in the table per patient?
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

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

    Default Re: Change table element from report

    David,

    One way to get started is to think about how you'd do it with paper and pencil. Then think about which commands or functions are available in alpha to perform each step.

    Doing this one step at a time might look like this:

    - open the patients table and get the balance_due figure
    - open the transaction table
    - filter to show only tnx (transactions) for the current patient
    - sum all the transaction charges one at a time by fetching through all tnx for that patient
    - on each fetch add the tnx charge to a running total
    - open the payments table
    - filter to show only payments for the current patient
    - sum all the payments for the current patient by fetching through all payments for the patient
    - on each fetch add the payment amt to a running total
    - subtract total payments from total charges
    - this should be your patient's current balance
    - change the balance_due in the patients table by replacing the old balance_due field value with the new one
    - commit the change to disk
    - close all opened tables

    This approach computes the new balance by stepping through all transactions and payments for the patient. It does not try to compute new charges and new payments and use them to adjust the previous balance due figure.

    there are summary operations available in Alpha that could simplify this, but if you're learning xbasic scripting doing it step by step will serve you well.

  15. #15
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Yes

  16. #16
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Tom,
    Almost to the line, I have already done exactly what you suggest. I use a filter (patient_no) to go through each patient, I total the patients bills for the month, total the patients payments for the month, then do a calculated field which essentially says (Total bills + opening balance) - Total payments. I get a new balance due for each patient. What I have not been able to do (is this circular reference?) is now do your "change the balance_due in the patients table (third line from bottom) How is this done??
    Thanks for your extensive answer.

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

    Default Re: Change table element from report

    this depends on "where" you are doing this work.

    Are you running a script?

    Are you trying to do this in your report?

    Describe what's going on in detail

    Added later: Check private messages here on this board
    Last edited by Tom Cone Jr; 08-04-2019 at 04:50 PM.

  18. #18
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Tom I have tried running a script which does the "totals" (total fees + opening balance) - total payment) exactly from the report so that what is calculated in each report is also calculated in the script. Just cant get it to actually change the balance due field in patients table.

  19. #19
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,366

    Default Re: Change table element from report

    I'm possibly lost, but do you want a value calculated on the form to update a field in a table?
    After the calculation?
    If you can calculate it in a report, it should be easy to create a calculated field and run the calc in a table.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  20. #20
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    That's exactly what I want and exactly what I thought. It should be easy. What does "run the calc in a table" mean?

  21. #21
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,366

    Default Re: Change table element from report

    Try this.
    Creat a test table, 3 fields
    Cost
    Salestax
    Result

    Cost = numeric
    Salestax =numeric
    Result = numeric, but, Field Rule for this field is Calculated.
    Calculated expression = Cost+Salestax.

    So your calculated field is in the table and you can use it in the report.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  22. #22
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Ted, Are you saying that my balance_due field should be a calculated field and use it to calculate the expression that I need? I hadn't considered that and will try it out now. Thanks for the thought.

  23. #23
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Change table element from report

    David,
    From the first post you wrote this:
    I have been trying to change a field from within a report.... I compute a "balance due" from other fields in the report and wish to open one of the tables in this set, replace a value in this table (opening balance)
    The calculations that are in the report should be able to be calculate outside the report and collected and then have that collection update the records that the report is reporting. To attempt to use the calculated values within the report as the data source to update the patient records will simply not work.

    I have attached a sample application that does what I believe you are seeking. The approach is to have the script that runs the report collect the same calculations that you have the report calculate and have this collection used to update the patient balance values.

    I hope this helps.
    Attached Files Attached Files
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  24. #24
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,366

    Default Re: Change table element from report

    Yes David, the table should have all of the necessary calculations (or at least the basis for the calculations) in it.
    If you are worried about space or table size, then the Report or any Form can have a Calculated Field on it which takes into account the base data.
    Nail down the data first.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  25. #25
    Member
    Real Name
    David Gilbert
    Join Date
    Dec 2006
    Location
    Nanuet New York
    Posts
    92

    Default Re: Change table element from report

    Mike Your suggestion is basically what I now have in my own desktop app. I thank you for your amazing work that you have done to get my app to work properly.
    david

Similar Threads

  1. browse element row height change ... how?
    By dmartens in forum Alpha Five Version 8
    Replies: 30
    Last Post: 04-25-2017, 06:24 PM
  2. Replies: 13
    Last Post: 07-10-2014, 10:00 PM
  3. How to change the table in a layout table report?
    By hecsan in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 07-03-2013, 05:07 PM
  4. Show/Hide element in Table Layout Report
    By gaby_h in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 05-11-2012, 07:25 PM
  5. Change table in report
    By edward.mattison@scbhn.org in forum Alpha Five Version 8
    Replies: 2
    Last Post: 11-19-2008, 03:59 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
  •