Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Problem passing value calculated in a report

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem passing value calculated in a report

    I am having trouble passing a value calculated in a report to a form elsewhere in the application.

    I have a report, let's call it "General Ledger". It has both summary and
    calculated field variables:

    SUMMARY:
    PAY1_TG defined as RECEIPTS->PAY1
    CHG_TG defined as RECEIPTS->CHANGE

    where "RECEIPTS" is a .DBF and "PAY1" AND "CHANGE" are fields in
    the "RECEIPTS" record. Of course.

    CALCULATED:
    C_TOTAL defined as SUMMARY->PAY1_TG - SUMMARY->CHG_TG

    and C_TOTAL is displayed on the report, and it is correct. OK.

    Now I want to pass the value of C_TOTAL to a "form" elsewhere in the
    application. In fact I already have a script variable, called %TOTAL.
    The field that feeds the area in the form is called SCRIPTS->TOTAL.
    I also have a TOTAL.VAR file in my SCP directory (assume the script
    path is pointed correctly to it). By the way, if I don't have the set
    statement described below, the value in TOTAL.VAR is the value that
    shows up in the described form field.

    There is a "script" file that runs the report called "LEDGER_P.SCP" and
    I have appended a {SET %TOTAL, "3.14"} to the end of it, and can
    correctly get that value to display on the form. But I can't figure out
    if I can use SUMMARY-> or CALC-> values in a script in order to pass
    a real value. If there is a way, I'm damned if I can figure out the syntax.

    The Release 6 manual says that you can specify summary fields in a
    form, but when I press F2 on the form, it has calculated fields, but
    no summary fields.

    #2
    Re: Problem passing value calculated in a report

    The attached zip file contains a database called weekends.dbf, a custom form, a custom browse, a custom menu bar and 2 keystroke scripts. The "prtsumry" keystroke script sets the %SYS_TRIG_REP_SEC_END variable to RPTSUMRY, prints the report, then clears the %SYS_TRIG_REP_SEC_END variable. The RPTSUMRY script sets the %TOTAL variable to the value of the report's SUMMARY->DATE1_CG summary field.

    {*This is the PRTSUMRY script*}
    {SET�%MODE,%SYS_VIEW_MODE}
    {ONMAIN�{{ONMAIN�{}}{%MODE}}}
    {SET�%SYS_TRIG_REP_SEC_END,"RPTSUMRY"}
    {ALTF10:2}pra{F2}A{F10}S{ENTER}
    {SET�%SYS_TRIG_REP_SEC_END,""}

    {*This is the RPTSUMRY script*}
    {IF�%SYS_REPORT_SECTION="Summary�Section",{
    {SET�%TOTAL,SUMMARY->DATE1_CG}
    }}

    Comment


      #3
      Re: Problem passing value calculated in a report

      Gary,

      Thank you very much for your solution. It gives me the syntax
      of the SET ( {SET %TOTAL, SUMMARY->DATE_CG} ) assignment
      statement and shows me when the value of the SUMMARY->variable
      is available.

      Also, I was unaware that there was script commenting, ( {* ... *} ),
      so that's good to know, also.

      I was wondering, could one simply put the {SET %TOTAL, ... } statement
      at the end of an existing script which prints the report? Wouldn't the
      SUMMARY->variable be available through the entire print operation?
      Is it necessary to detect WHEN the report is using the SUMMARY->variable
      in order to use its value? Or, are you just illustrating the art of variable
      passing for my benefit?

      I got the example up and running fairly easily. I'll experiment with it.
      I suppose I can answer the above question for myself by experimentation,
      but your opinion would be helpful, anyway.

      If you wrote this example just to illustrate the solution, I thank you.
      Last edited by Arthur D. Libin; 08-15-2006, 03:41 AM.

      Comment


        #4
        VSAVE/VRESTORE commands and *.VAR files

        This is an addendum to the above messages.

        In Gary's example (c.f. "rptsumry.zip"), which I downloaded, unzipped
        and ran, it performs the function I was looking for, that is it calculates
        a SUMMARY->value in a report, then passes it to a field in a form via
        a script variable ("%TOTAL"). This is what I was looking for.

        There is no use of an external TOTAL.VAR file. This may be the key to
        what is bollixing up my application. I DO have a TOTAL.VAR file.

        I think, whatever I am calculating in the report section is being
        overwritten by a VRESTORE command (which I cannot find). No matter
        what I calculate in the report, the value in TOTAL.VAR overwrites it
        by the time the form is being displayed.

        So, my current exploration involves finding VSAVE and/or VRESTORE
        commands. The question in my mind is why they were there in the
        first place.

        Anyway, thanks again to Gary whose comments at least gave me
        fresh avenues to solve my problem.

        Comment


          #5
          Re: Problem passing value calculated in a report

          To those who read my earlier postings and replied... thank you. I have
          solved the problem.

          Although all the data I gave was true, it was misleading. The solution
          was that the external script variable, TOTAL.VAR, had not been
          initialized properly.

          Every time a transaction was processed, it would add a value to that
          contained in TOTAL.VAR (%TOTAL, SCRIPTS->TOTAL). The addition
          was performed properly, but if the initial value was incorrect, then
          it made successive adds to the wrong initial value.

          Running another report (call it "LEDGER") computed the correct value
          and reported it in the LEDGER report. So it gave the correct value of
          SCRIPTS->TOTAL at the time this report was run (although arrived at
          by a different method of calculation). I then changed the
          value contained in TOTAL.VAR-> ("SCRIPTS->TOTAL") by one of two
          methods:

          a) Using Alt-F3 to get at the script variables. I tabbed down to
          the %TOTAL line and changed the value of the variable. Note
          that one is obliged to process at least one transaction to make
          sure that SCRIPTS->TOTAL is written to the TOTAL.VAR file
          (the script that processes a transaction has a {VSAVE ... }
          command to write the value to the file; this is very important
          to remember... and is very easy to forget!);

          b) Manually edit TOTAL.VAR with a plaintext editor, such as
          NOTEPAD:
          i) Call up NOTEPAD;
          ii) File > Open, and browse to:
          C:\ALPHA4V8\SCP\TOTAL.VAR (or wherever it is);
          iii) Open the file, change the value TOTAL = xxxxxx (the x's
          represent the value to be changed), save the file;
          iv) Restart a4 (which should have been exited before you
          started to edit TOTAL.VAR).

          The correct value will appear in the screen form, and will continue to
          be calculated correctly.

          Comment

          Working...
          X