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

Creating a temp table for a report

  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating a temp table for a report

    I have this huge set where all of a client's data is displayed on a form that various reports can be run from.
    But now they want a report that will show checkboxes based on which fields have entries from the different tables.

    So eg, say a client receives food stamps and social security. In the relevant table amounts are entered, but in this
    report, a check box should appear instead. And that is just 2 fields to be checked both from the same table.
    I have about 8 tables and 50 fields to search.

    I could use some ideas on how to go about doing this...with as little user interaction as possible!

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

  • #2
    Re: Creating a temp table for a report

    Can be done. I created a set with 12 tables and then created a temp separately with exact fields for printing a bank contract. Then went and filled the fields using an operation from a set. Made the report based on the temp table which never got deleted and printed the contract with Crystal Reports due to alpha not being able to. Used join, I think
    Dave Mason
    Skype is dave.mason46


    • #3
      Re: Creating a temp table for a report

      Hi Robin,
      So 1) how do you want the end report to be grouped - by person with details of their 50 fields, or other? 2) Do you want to have all 50 fields displayed and those that have values a checkbox marked, or just the fields that have values show on the report?
      Mike W
      "I rebel in at least small things to express to the world that I have not completely surrendered"


      • #4
        Re: Creating a temp table for a report

        Hi Robin,
        Fun exercise. Here is one way (see attached). Lot's of other possibilities depending upon what the requirements for your outcome report.
        Attached Files
        Mike W
        "I rebel in at least small things to express to the world that I have not completely surrendered"


        • #5
          Re: Creating a temp table for a report

          Thank you Mike, I will review and get back to you...

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


          • #6
            Re: Creating a temp table for a report

            This is an example of the data I want to pull from the tables & fields listed. Notice some of the fields do not have table-fields.
            This is the data that will then be presented to the user to review and select or fill in the remaining blanks (if any). This temporary table will then
            be posted as one record linked to the client and the report will be based on that table. The report will show all the fields.
            Other fields not shown will provide the linking data. I have the post completed since I can map on TALLY_ID.

            Last edited by MoGrace; 05-06-2019, 01:21 PM.

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


            • #7
              Re: Creating a temp table for a report

              Reviewing Mike's example gave me an idea on where to start.

              First I made a new set with just the tables I need to get the fields to test.
              Next I created a Copy operation to create the fields from those tables for a one record TmpTally table.
              I also added an Update to clear the TALLY and SEL_FLAG fields and a Post operation to reset the link fields in the Tally table.
              (I chose this instead of Zap & Append because it was easier.)

              From the TmpTally table I could get a field list to manipulate and map to the Tally records I want to update which is displayed to the user to complete
              since in some of the Tally records the fields are going to be blank.

              Both tables are sorted on the FLDNAME field which helped fetch_find() work faster I think.
              I added a unique index to Tally to remove any blank FLDNAME records except for the 1st which I could test for and skip.
              There are still a few mapping issues to tweak but here is the 'working' script - which is open to improvement!:

              'Date Created: 07-May-2019 01:35:59 PM
              'Last Updated: 07-May-2019 02:04:34 PM
              'Created By  : Robin Q
              'Updated By  : Robin Q
              'Selected fields from the CL_TALLY.Set (5 tables) are copied to TmpTally for the current record.
              dim global Get_iKey as c      'global var is used to filter the operations
              dim hdr as p		       'Int_hdr
              dim tbl as p		       'Tally
              dim tmp as p		       'TmpTally
              dim fldname as c
              dim flds as c
              dim tfld as c
              dim tname as c
              dim xlist as c
              dim cnt as n = 0
              dim errcnt as n = 0
              dim fcnt as n = 0
              dim rec as n = 0
              dim xn as n = 1
              dim commit_flag as L
              dim flag as L
              'exclude character fields so only logical or numeric fields are in the list
              hdr = table.current()
              Get_iKey = hdr.intake_id
    "CL_Tally to TmpTally")      'not silent to show user a record was created
              update.run_silent("Clear Tally")
              post.run_silent("Int to Tally")
              tname = "TmpTally"
              flds = table.external_field_name_get(tname,"n")
              flds = word_subtract(flds,xlist,crlf())
              flds = sortsubstr(flds,crlf())
              fcnt = line_count(flds)
              tbl ="Tally",FILE_RW_SHARED)
              tmp =,FILE_RW_SHARED)
              'tmp s/only contain 1 record
              for xn = 1 to fcnt
              	fldname = word(flds,xn,crlf())
              	if fldname = "" then
              		goto SKIPIT
              	end if
              	tfld = tname+"->"+fldname    'this was the format isblank() would accept
              	flag = .not. isblank(tfld)	'reverse the result to post, if isblank returns true then flag is false
              	rec = tbl.fetch_find(fldname)		
              	if rec < 0 then
              		'matching record not found
              		goto SKIPIT
              	end if
              	commit_flag = .t.
              	on error goto ERRMSG
              	if tbl.typeflag = "L"
              		tbl.sel_flag = flag
              		tbl.tally = eval("tmp."+fldname)
              	end if
              	if commit_flag then
              		cnt = cnt+1
              	end if
              Tln("Tally records posted "+Get_iKey,""+cnt,"Scripts")
              commit_flag = .f.
              on error goto 0
              errcnt = errcnt+1
              'stop error loop at 2
              if errcnt < 3 then
              	RESUME NEXT
              	RESUME ENDIT
              end if
              Last edited by MoGrace; 05-08-2019, 12:45 PM.

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


              • #8
                Re: Creating a temp table for a report

                Sample form to display to user to complete before using buttons above. The grayed out fields are only visual to show non-entry fields.


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