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

Trouble Writing an Expression for a calc field

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

    Trouble Writing an Expression for a calc field

    I'm using the following expression in the builder but not getting the desired result:

    Blank_Duplicate(Total((isnotblank("Inst1") ) .and. (isnotblank("Location") ) .and. (isnotblank("Course_Name")) .and. (between(course_start_date,ctod("01/01/2014"),ctod("12/31/2014")) ),Grp->Course_Name))

    I want it to count only one instance where the "inst1" "Location" "Course_Name" and "Course_start_Date" fields match; the table has multiple entries with the same information, but I want it to count these fileds that match as 1 class presentation.

    Im trying to figure out how many times a certain course has been presented at our school throughout the year.

    Please help, thank you.

    -Ivan

    #2
    Re: Trouble Writing an Expression for a calc field

    Not clear where you want this information. I would summarize the table, grouping on each of the four fields and filtering for isnotblank() each of them. The result table would have one record for each combination. A tablecount() expression could then yield the final number.
    There can be only one.

    Comment


      #3
      Re: Trouble Writing an Expression for a calc field

      The table im pulling information from has every student who has taken a class along with location, class dates and instructor; so currently if 12 students took class "A" on 01/27/14, and 3 students took that same class on 01/28/14 (same location, same class) the report is returning a total of 15 records. What I would like it to return is how many times class "A" was taught (using the other three fields as the differentiating factor). Now assuming these are the only records in my table, the count returned that I want should be 2 not 15.

      I guess the real question would be, how do I count records in a table (using a report) without it counting duplicates? Ignore the duplicate records?

      Im using the expression builder in a report using calc fields to get my desired result. Sorry if I sound all-over-the-place, but this has been frustrating me for a few days now.

      Comment


        #4
        Re: Trouble Writing an Expression for a calc field

        You probably want tablecount() with unique_key_value() in the filter.
        There can be only one.

        Comment


          #5
          Re: Trouble Writing an Expression for a calc field

          Am I going to use both the Tablecount(), and Unique_Key_Value() functions together? Ive tried putting it together but I guess my syntax is all wrong because the builder states <invalid or incomplete expression>. Heres what Im writing:

          TableCount(("Courses", "Course_Name=' ' ")+Unique_Key_Value(isnotblank("Course_Name")+isnotblank("Inst1")+isnotblank("Location"),grp->Course_Name)

          If feel as though I may be over-complicating this

          Comment


            #6
            Re: Trouble Writing an Expression for a calc field

            Syntax

            Logical Result_Flag = UNIQUE_KEY_VALUE()

            Description

            The UNIQUE_KEY_VALUE() function is a special function that returns .T. (TRUE). Its sole purpose is for use in a filter expression where you want to return only those records with unique key values that satisfy the filter expression.
            Unique_key_value() doesn't accept parameters.

            TableCount(("Courses", "isnotblank(\"Course_Name\") .and. isnotblank(\"Inst1\") .and. isnotblank(\"Location\") .and. Unique_Key_Value())

            would count all the unique combinations of Course_name, Inst1, and location.
            There can be only one.

            Comment


              #7
              Re: Trouble Writing an Expression for a calc field

              Thanks again Stan

              However, that syntax you gave me above is also giving me <invalid or incomplete expression>, I tried adjusting it to be a bit simpler and move on to a more complex equation from there, and I entered the following:

              tablecount(("Courses","Course_Name='Air Tools'") which returned 36. and that's correct (all is fine here) but when I try to enter

              tablecount(("Courses","Course_Name='Air Tools'" .AND. "Inst1='Martin Radsliff'")) it states <invalid or incomplete expression>.

              Is there any material you can recommend where I can read the functions and proper use of the syntax for the functions. Majority of the time I'm writing these I get it wrong because I'm either missing a period or a comma or an apostrophe and that's extremely frustrating.

              Comment


                #8
                Re: Trouble Writing an Expression for a calc field

                hello
                try this
                tablecount("Courses","Course_Name='Air Tools' .AND. Inst1='Martin Radsliff'")
                the filter needs to be one character string
                see if this works.

                more complex:
                tablecount(table_name, "condition1='condition1' .AND. condition2 = 'condition2' .AND. condition3 = 'condition3' .....conditionN = 'conditionN'")
                Last edited by GGandhi; 01-30-2014, 09:17 AM. Reason: more complex
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #9
                  Re: Trouble Writing an Expression for a calc field

                  Thanks GGhandi, that does work, but how do I get it to count Course_Name as a variable? I don't only want it to count all instances of "Air Tools" class, I want a count of all the different courses we've offered for the current year. Writing Course_name="Air Tools", Course_Name="Aerial Boom Lifts", Course_Name="Concrete R&R" etc. is not a practical way of doing this; What's the expression to accomplish this?

                  And as a side question, how long can an expression in the Expression Builder be? Is there a limit?

                  Comment


                    #10
                    Re: Trouble Writing an Expression for a calc field

                    Ivan

                    Where do you want this value to show?

                    On a report, a form, a browse, or some where else?

                    You are going down a path but we don't know where that path is leading to...
                    Al Buchholz
                    Bookwood Systems, LTD
                    Weekly QReportBuilder Webinars Thursday 1 pm CST

                    Occam's Razor - KISS
                    Normalize till it hurts - De-normalize till it works.
                    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                    When we triage a problem it is much easier to read sample systems than to read a mind.
                    "Make it as simple as possible, but not simpler."
                    Albert Einstein

                    http://www.iadn.com/images/media/iadn_member.png

                    Comment


                      #11
                      Re: Trouble Writing an Expression for a calc field

                      Sorry for the miscommunication, this will go on a report.

                      Comment


                        #12
                        Re: Trouble Writing an Expression for a calc field

                        Great.

                        Looking back I do see on post #3 you mentioned report.
                        Al Buchholz
                        Bookwood Systems, LTD
                        Weekly QReportBuilder Webinars Thursday 1 pm CST

                        Occam's Razor - KISS
                        Normalize till it hurts - De-normalize till it works.
                        Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                        When we triage a problem it is much easier to read sample systems than to read a mind.
                        "Make it as simple as possible, but not simpler."
                        Albert Einstein

                        http://www.iadn.com/images/media/iadn_member.png

                        Comment


                          #13
                          Re: Trouble Writing an Expression for a calc field

                          Since you are using this in a report and you want all of the values for a course and location calculated, I would look at grouping the data and using the wizard to help you build the calculated field.

                          From the drag and drop list you can turn the wizard on and drag a field onto a footer. That will start the wizard and give you a variety of options to buid your calculation. Be sure to look at all the options available......
                          Al Buchholz
                          Bookwood Systems, LTD
                          Weekly QReportBuilder Webinars Thursday 1 pm CST

                          Occam's Razor - KISS
                          Normalize till it hurts - De-normalize till it works.
                          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                          When we triage a problem it is much easier to read sample systems than to read a mind.
                          "Make it as simple as possible, but not simpler."
                          Albert Einstein

                          http://www.iadn.com/images/media/iadn_member.png

                          Comment

                          Working...
                          X