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

Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

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

    Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

    Hi guys,
    I�m designing a form based on a set containing 3 tables:
    Tbl_Employees linked to Tbl_Loan_Master (Emp_ID) which is linked to Tbl_Loan_Trans (Loan_ID)

    On the main body of the form is the �master� info relating to Employee and two browses containing the other tables.

    I want to put a calculated field at the top of the form (Loan_Totals) which should through using a script scan through the Tbl_Loans and get the figures from each record relating to Emp_ID

    To explain it better a little �pseudocode�

    In VBA I would have done a simple :

    do while (Tbl_Loan_Master) Emp_ID = (Tbl_ Employees) Emp_ID
    For i =1 to eof
    vTot = vTot+LoanAmts
    next I etc


    I need another calculated field in the Loan Browse area totalling all transactions relating to a particular loan

    In VBA I would have done a simple :

    do while (Tbl_Loan_Trans) LoanID = (Tbl_ Loan_Master) Loan_ID
    For i =1 to eof
    vTot = vTot+AmountPaid
    next I etc

    I suspect inn Alpha Five the Tablesum() function is the way to go. Maybe I�m being thick but no matter what combination I try I get errors.

    In first instance I think it should read something like:
    tablesum("Tbl_Loan_Master","Emp_ID� ="tbl_Employees.Emp_ID�,� Loan_Amts")
    In second instance I think it should read something like:
    tablesum("Tbl_Loan_Trans","Loan_ID� ="Tbl_Loan_Master","Loan_ID� Amount_Paid")
    Would some be so kind as to tell me what I should be doing??

    Alan

    #2
    Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

    Originally posted by AlanMalawi View Post
    Hi guys,
    I�m designing a form based on a set containing 3 tables:
    Tbl_Employees linked to Tbl_Loan_Master (Emp_ID) which is linked to Tbl_Loan_Trans (Loan_ID)

    On the main body of the form is the �master� info relating to Employee and two browses containing the other tables.

    I want to put a calculated field at the top of the form (Loan_Totals) which should through using a script scan through the Tbl_Loans and get the figures from each record relating to Emp_ID

    To explain it better a little �pseudocode�

    In VBA I would have done a simple :

    do while (Tbl_Loan_Master) Emp_ID = (Tbl_ Employees) Emp_ID
    For i =1 to eof
    vTot = vTot+LoanAmts
    next I etc


    I need another calculated field in the Loan Browse area totalling all transactions relating to a particular loan

    In VBA I would have done a simple :

    do while (Tbl_Loan_Trans) LoanID = (Tbl_ Loan_Master) Loan_ID
    For i =1 to eof
    vTot = vTot+AmountPaid
    next I etc

    I suspect inn Alpha Five the Tablesum() function is the way to go. Maybe I�m being thick but no matter what combination I try I get errors.

    In first instance I think it should read something like:
    tablesum("Tbl_Loan_Master","Emp_ID ="tbl_Employees.Emp_ID�,� Loan_Amts")
    In second instance I think it should read something like:
    tablesum("Tbl_Loan_Trans","Loan_ID� ="Tbl_Loan_Master","Loan_ID� Amount_Paid")
    Would some be so kind as to tell me what I should be doing??

    Alan
    Hi Alan

    As you are on a form a calculated field should do the trick, drag the new calculated filed object from the picker to the form and follow the genie.

    Tablesum will also work but it looks like your code has too many " remove the two I have indicated in red and see if that works. Basically the function is expecting a character response.
    Glen Schild



    My Blog

    Comment


      #3
      Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

      Hi Glen, Thanks for real quick response.
      What my big problem is, is that I dont understand the prompts when entering the tablesum() calc
      Example function reads: tablesum("1�, "2", "3")
      ("1"). Should this be the table containing the field to be added or the table containing the field that needs to be matched (In my first instance - Loan_Master or Employee respectively
      ("2").What is format here? Do I simply put in field name or must it be full statement? (In my first instance, "Emp_ID" or something like "tbl_Employee.Emp_ID=tbl_Loan_master.Emp_ID"
      ("3"). This I gather is just the field to be summed. Is it referred to (in first instance, as just "LoanAmount" or as "tbl_Loan_Master.LoanAmount". Also I dont understand why a numeric field should be enclosed in "" ???

      Thanks again for your help
      Alan

      Comment


        #4
        Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

        Hi Alan

        This is fundamental to grasping the power of Alpha. See the attached screenshot.



        When alpha recognises the function you are creating you see a pop up help balloon which tells you what is expected.

        In this instance the help starts with "N" which tells you the return value will be numeric. The three components to this function: "tablename", "filter" and "Field" are all prefaced with "C" which tells you alpha is expecting the contents of this function to be character based and therefore wrapped in ""

        eg: tablesum("tablename","filtervalue = 25","field to return value from")

        There is a lot of good info in the help files about this.

        Regards
        Glen Schild



        My Blog

        Comment


          #5
          Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

          Tips for writing expressions.

          And, the data type of each parameter that must be passed to a function is shown in the help system, and in the auto-complete sequence. These are helpful reminders, but should not, themselves, appear in the parameters you actually use.

          Comment


            #6
            Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

            I think it is covered in the link Tom provided but to emphasize....

            Filter expressions (or criteria) in Alpha are character strings, no matter the data types being ccompared. Character strings begin and end with quote marks. If quote marks are necessary inside the string they can either be replaced with single quotes, or escaped double quotes (\"). Character strings can be built by concatenating multiple pieces (+). Everything inside the outer quotes is evaluated as literal. If you want to substitute a value for something in the character string you have to stop the expression, concatenate the variable containing the value, concatenate the remainder of the string.

            The filter string in your tablesum

            tablesum("Tbl_Loan_Master","Emp_ID” ="tbl_Employees.Emp_ID”,” Loan_Amts")

            "Emp_ID” ="tbl_Employees.Emp_ID”

            could be verbalized with a sample value as
            Emp_ID = "EMP05A"

            add outer quotes
            "Emp_ID = "EMP05A""

            we now have quotes within quotes to handle
            "Emp_ID = 'EMP05A' "

            so we know what the filter string should look like with a static value
            replace the static value with the dynamic
            "Emp_ID = 'tbl_Employees.Emp_ID' "

            since the dynamic is hidden within quotes we have to stop and restart the string so Alpha knows we want the value it contains

            "Emp_ID = ' "+tbl_Employees.Emp_ID+" ' "

            This is fine for character values. Other accomodations are made if the dynamic value is of a different data type to convert that type to be included in the character string.
            There can be only one.

            Comment


              #7
              Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

              Hi Stan,
              Thanks for making so much effort to help me - I do appreciate it. However when I type in the following line:
              tablesum("loan_tran","Loan_ID"="'"+Loan_Master.Loan_ID+"'","Tranamt") ......

              I get an error message saying "Argument is incorrect data type"
              Tranamt is Numeric, others are character fields.
              Thanks, Alan

              What am I doing wrong?

              Comment


                #8
                Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

                Hi Glen
                Thanks for this.
                I have used the help but am still confused
                tablesum("tablename","filtervalue = 25","field to return value from")
                Is tablename in this case the Parent table containing the field loan_Id
                In filter value - I want to total records in Child file (Loan_Tran) where the Child.Loan Id = Parent. Loan ID
                "the field to return value from" I guess would be the Amount field inj the Child file
                So am I correct in assuming it to be: Tablesum("Parent","child.LoanID="'"+"parent.LoanID+"'", "child.TranAmt" ????
                Thanks for your help
                Alan

                Comment


                  #9
                  Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

                  Originally posted by AlanMalawi View Post
                  What am I doing wrong?
                  As I stated.

                  This is fine for character values.
                  Since a numeric value is not quoted ........

                  tablesum("loan_tran","Loan_ID= "+str(Loan_Master.Loan_ID),"Tranamt")
                  or taking advantage of Alpha's automatic type conversion for numerics during concatenation
                  tablesum("loan_tran","Loan_ID= "+Loan_Master.Loan_ID,"Tranamt")

                  Thanks Mike, yes it appears an extra quote snuck into the expression. I neglected to delete it when removing the quotes around the numeric variable. Now fixed.
                  Last edited by Stan Mathews; 02-13-2012, 09:33 AM.
                  There can be only one.

                  Comment


                    #10
                    Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

                    Hi,
                    I'll chime in.
                    Code:
                    tablesum("loan_tran","Loan_ID[COLOR="#FF0000"][SIZE=5][B]"[/B][/SIZE][B][/B][/COLOR]= "+Loan_Master.Loan_ID,"Tranamt")
                    The quote following the table name in the filter should not be there.
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

                      Originally posted by glenschild View Post
                      .....When alpha recognises the function you are creating you see a pop up help balloon which tells you what is expected......
                      Frequently it fails to recognize though.... When it does, you can use the X-basic Explorer. (XbE)

                      When you don't see "bubble help", try dragging and dropping what you need from: Objects-->Windows-->Form branch.
                      If this doesn't work (still no bubble help), look for the same "drag & drop" from: Objects-->System-->A5 branch.
                      (And after using the bubble help, you can make it look just like the first drag and drop by removing the a5 prefix etc.)


                      Here's another link that might help re: optional ways to do what you want: http://msgboard.alphasoftware.com/al...m()-vs-DBsum()

                      And another: http://www.learn alpha.com/QuerySynt...axGlossary.htm
                      And another: http://msgboard.alphasoftware.com/al...L_EXPRESSION() (aka Code indirection)
                      Last edited by SNusa; 02-13-2012, 08:48 PM.
                      Robert T. ~ "I enjoy manipulating data... just not my data."
                      It's all about the "framework." (I suppose an "a5-induced" hard drive crash is now in order?)
                      RELOADED: My current posting activity here merely represents a "Momentary Lapse Of Reason."

                      Comment


                        #12
                        Re: Tablesum() - Multi tables - I dont understand criteria (Alpha Five v11)

                        Hi,

                        Thanks so much for all the input.

                        I'm probably being dumb but I'm finding I get inconsistent results when working with different forms.
                        I am mainly working around this by using the built in total facility that pops up when you drag a field accross onto the form.

                        Thanks to ALL of you for being so patient.

                        Alan

                        Comment

                        Working...
                        X