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

A way to determine what's missing from a Child Table

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

    A way to determine what's missing from a Child Table

    I would like to have a user enter a year and quarter via an Xdialog Box and then produce a Report of Residents whos dues are unpaid for that quarter.

    The 2 tables are:
    Resident_tbl contains...
    Res_Id numeric 5 Linked to Res_Chld_Tbl 1 to many
    Res_Name character 40
    Res_Addr character 40

    Resident_chld_tbl contains....
    Res_Id_chld numeric 5 Linked to Resident_tbl
    Dues_Year numeric 4
    Dues_Quarter numeric 1 1,2,3, or 4
    Dues_Amt numeric 8 6.2

    Example:
    There are 2 entries in the Resident_tbl. They are:
    1 Joe Blow 16 Langley Toms River NJ 08757
    2 Tom Smith 8 22nd St New York NY 56768

    Therre are 4 entries in the Resident_Child_tbl for Resident 1. They are:
    1 2009 3 36.00
    1 2009 1 36.00
    1 2008 4 36.00
    1 2008 1 36.00

    There are 5 entries in the Resident_Child_tbl for Resident 2. They are:
    2 2009 1 36.00
    2 2008 4 36.00
    2 2008 3 36.00
    2 2008 2 36.00
    2 2008 1 36.00


    If the user enters the year 2009 and quarter 2, the Report should look something like this:
    Un-Paid Dues for Report for 2009, 2nd Quarter

    1 Joe Blow 16 Langley Toms River, NJ 08757 2009 2 36.00
    2 Toms Smith 8 22nd Street New York NY 56768 2008 2 36.00
    ______________
    Total Un-Paid Dues 72.00

    This seems extremely complicated to me. I posted it in this Forum because the activity here is much greater than the code forum and I'm hoping that one of you experts can help out.

    Thanks,
    Rudy

    #2
    Re: A way to determine what's missing from a Child Table

    It is much easier to report on something that exists than something that doesn't.

    Add a field to Resident_Child_tbl. You could have a logical field for "paid" or you could have a numeric field for dues_paid. "Bill" every resident each quarter of each year and record payments. (Create a record for every resident showing the dues_amt and fill in the dues_paid when it is paid.)

    With this set up it should be fairly easy to construct a report for records where the "paid" logical field is false or the dues_paid" numeric field is 0.
    There can be only one.

    Comment


      #3
      Re: A way to determine what's missing from a Child Table

      I completely agree with Stan. I will add these notes. The example you gave has both residents at different addresses paying the same amount. If every resident has the same payment, all is easy, but what if the missed payment is a different amount? You can detect a record that shold be there but is not, but how would you expect the report to "know" how much is missing? And I will add my soapbox item. You have the resident id as a numeric field. Unless something is going to be used for mathmatical actions, character field is a better choice.
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


        #4
        Re: A way to determine what's missing from a Child Table

        Thanks to both of you for your quick response.

        Although the amounts are the same in my example, they can be different. For example, if late, a 25.00 add on charge will be applied, thus making the dues amount due 51.00 instead of 36.00. There are also other assessments which I will not get into right now that can be tacked on.

        Mike,
        Resident_Id is an auto-increment field so that when I create a new resident, a unique Id will be created. I also do not have to know how much dues is required. The exception report will simply have the Name, Address, and Telephone number there for the Dues Administrator to contact. The administrator determines how much is due. My report example should have no dues amount shown and a telephone number on it. My fault.

        Stan, your suggestion is simple and spot on. The only thing is I would have to come up with a routine to read each master record and create 4 child records for each year, each quarter and set the payed/not payed bit to "n". "y" = Paid. "n" equals Not Paid. I would like to assign it to a button so the user can enter the year he want's to set up and then run the routine on "Push" to create all the child records for each Master resident record. Example: The user enteres 2010 and 4 child records are created for each resident master record, 2010 for 1st qtr, 2010 for 2nd qtr, 2010 for 3rd qtr and 2010 for 4th qtr. I'm not able to write this script. I need an expert like yourself.

        An additional field (pay or not payed) is perfect. This way I can check the quarter and year and if they match, check the payed or not payed field.

        I'm sorry if I confused you with my example. Hope this clears things up.

        The Un-Paid Dues Report would look something like this:

        Un-Paid Dues for 2009, 2nd Quarter Report

        1 Joe Blow 16 Langley Toms River NJ 08757 2009 2 732-554-1212
        2 Toms Smith 8 22nd Street New York NY 56768 2009 2 732-244-8756


        Thanks,
        Rudy

        Comment


          #5
          Re: A way to determine what's missing from a Child Table

          Unzip to a new location and open the database. Enter a year and an amount and press the bill button.

          Examine the results.

          I did not put any safety code to prevent billing the same year more than once.
          There can be only one.

          Comment


            #6
            Re: A way to determine what's missing from a Child Table

            Stan,

            Beautiful. Can I remove the "query.order" line from the script? The Resident Master recodrs are in a different sequence.

            Also, it would be important to include a safety method to prevent from adding a year twice.

            Thanks,
            Rudy

            Comment


              #7
              Re: A way to determine what's missing from a Child Table

              Done.
              There can be only one.

              Comment


                #8
                Re: A way to determine what's missing from a Child Table

                Stan,
                Copied and Pasted you examples to my test db on my desktop, modified your script and tested it out. I added a quarter variable also so a user could select a specific year and quarter. It worked great on my desktop.

                I have a near working model on my laptop and typed in the below script into it.

                I keep getting:
                Error on Line 30, Column 1,
                Error: Missing END IF Command.

                when I try to save the script from the editor.

                I don't see where the error is. Perhaps you can identify it.


                tbl=table.current()
                query.filter=".T."
                query.order=""
                query.description="temporaqry Query"
                query.options="I"
                tbl.query_create()
                tbl.fetch_first()
                dest=table.open("clients_child")
                query.filter="Qtr_Year="+var->yr
                query.filter="QTR="+var->Quarter
                query.order=""
                query.description="Temporaqry Query"
                query.options="I"
                ix=dest.query_create()
                recs=ix.records_get()
                if recs=0
                while.not.tbl.fetch_eof()
                dest.enter_begin()
                dest.Child_Rec_No=tbl.Mst_Rec_No
                dest.Qtr_Year=var->yr
                dest.Qtr=var->Quarter
                dest.Qtr_amt=var->due
                dest.Paid="n"
                dest.enter_end(.t.)
                tbl.fetch_next()
                end while
                else
                ui_msg_box("Oops","Buckets for "+alltrim(str(var->yr))+"have already been done.",UI_OK)
                end if
                dest.query_detach_all()
                dest.close()

                Comment


                  #9
                  Re: A way to determine what's missing from a Child Table

                  Stan,

                  I removed "query.filter="QTR="+var->Quarter" from the script and it worked fine when entering a Year and Quarter however, after I run the script for 2009, 1st quarter and all entries are created correctly, when I try and run the script again for 2009, 2nd quarter, I hit the UI_Msg because I guess the year was already created.

                  How can the script be modofied to Check for the year and quarter instead of just the year?

                  Please advise.

                  Thank you,
                  Rudy

                  Comment


                    #10
                    Re: A way to determine what's missing from a Child Table

                    The script (on the button) is designed to create the entire billing for the next (designated) year. I suggest you manually create the necessary records for 2009 and proceed from that point.

                    I could probably modify the script but it would be at least Wednesday of next week.
                    There can be only one.

                    Comment


                      #11
                      Re: A way to determine what's missing from a Child Table

                      Thanks Stan. I'll manually create them for now.

                      Comment


                        #12
                        Re: A way to determine what's missing from a Child Table

                        Stan,

                        It's Wednesday and I thought I'd ask if you could look at the encloses script that I used to create child records based on a year and quarter variable accepted from an x-dialog form. It creates a child record for every parent record in the table for a specific year and quarter.

                        There is no code to check to see if a year and quarter has been run before. The variables accepted are yr and Quarter. While this works fine, I'd like to have a check coded in the script that checks to make sure a year and quarter can only be run once.

                        Can you review this for me and assist.

                        Thanks,
                        Rudy


                        'Date Created: 29-Jun-2009 07:20:49 AM
                        'Last Updated: 29-Jun-2009 07:27:03 AM
                        'Created By : Rudy
                        'Updated By : Rudy
                        tbl = table.current()
                        query.filter = ".T."
                        query.order = ""
                        query.description = "Temporary Query"
                        query.options = "I"
                        tbl.query_create()
                        tbl.fetch_first()
                        dest = table.open("clients_child")
                        while .not. tbl.fetch_eof()
                        dim p3 as waitdialog
                        p3.create(2,"repeating")
                        p3.set_bottom_message("hello. i am working...")
                        dest.enter_begin()
                        dest.Chld_Rec_No = tbl.Mst_Rec_No
                        dest.Qtr_Year = var->yr
                        dest.Qtr = var->Quarter
                        dest.Qtr_amt = var->due
                        dest.Paid = "n"
                        dest.enter_end(.t.)
                        tbl.fetch_next()
                        end while
                        p3.close()
                        dest.query_detach_all()
                        dest.close()

                        Comment


                          #13
                          Re: A way to determine what's missing from a Child Table

                          Try this.

                          Code:
                          tbl = table.current()
                          query.filter = ".T."
                          query.order = ""
                          query.description = "Temporary Query"
                          query.options = "I"
                          tbl.query_create()
                          tbl.fetch_first()
                          dest = table.open("clients_child")
                          query.filter = "Qtr_Year = "+var->yr +".and. Qtr = "+ var->Quarter
                          query.order = ""
                          query.description = "Temporary Query"
                          query.options = "I"
                          ix = dest.query_create()
                          recs = ix.records_get()
                          IF recs = 0
                          	WHILE .not. tbl.fetch_eof()
                          		dim p3 as waitdialog
                          		p3.create(2,"repeating")
                          		p3.set_bottom_message("hello. i am working...")
                          		dest.enter_begin()
                          		dest.Chld_Rec_No = tbl.Mst_Rec_No
                          		dest.Qtr_Year = var->yr
                          		dest.Qtr = var->Quarter
                          		dest.Qtr_amt = var->due
                          		dest.Paid = "n"
                          		dest.enter_end(.t.)
                          		tbl.fetch_next()
                          	END WHILE
                          ELSE
                          	ui_msg_box("Oops","Already created that year and quarter.")
                          END IF
                          p3.close()
                          dest.query_detach_all()
                          dest.close()
                          There can be only one.

                          Comment

                          Working...
                          X