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

Filter issue

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

    Filter issue

    In an attempt to avoid hard coding I created next script that needs to save location based reports in PDF format and FTP those reports to a website.

    dim lijst as C
    dim tbl as p
    dim recs as n

    tbl = table.open("facility")
    tbl.fetch_first()
    count = tbl.records_get()
    while .not. tbl.fetch_eof()
    for i = 1 TO count
    debug(1)
    lijst = tbl.Tfc_Id
    query.filter = "tbl.Tcf_id = var->lijst"
    ' query.order = ""
    query.options="N"
    query.decription="Number Locations"
    Report.SaveAs("Booking report","PDF",query.filter,query.order,var->lijst+"."+"PDF")
    tbl.fetch_next()
    next i
    end while
    tbl.close()
    end

    There seems to be an error in the query filter and I have no idea what's wrong. Perhaps any of you could help?

    Thanks,
    Jo Hulsen
    Dommel Valley Solutions
    The Netherlands

    #2
    Re: Filter issue

    As others have noted a useful troubleshooting technique for query filter expressions is to strip out the variables and insert literal values. Get the report to run for a single case, then examine the expression carefully. Are quotes needed? Where are they placed? then substitute a variable for the literal, being careful to include quotes where needed.

    -- tom

    ps Your script will be easier to read if formatted with indents. Formatted code will be pushed to the left margin by the message board editor unless you surround it with CODE tags, an option available to you only if you use the advanced reply editor.

    Comment


      #3
      Re: Filter issue

      Thanks Tom,

      I was already following the single report route without use of variable. Think I need to do a bit more research.

      Also thanks for your ps. Script was formatted but I had no clue as to how it would appear in a message.
      Jo Hulsen
      Dommel Valley Solutions
      The Netherlands

      Comment


        #4
        Re: Filter issue

        I was already following the single report route without use of variable. Think I need to do a bit more research.
        As Tom indicates, start with the filter in the simple report you have now. Since your script indicates

        dim lijst as C

        it is likely your filter in the simple report looks like

        Tcf_id = "some_value_here"

        When you change to a variable in a script you have to quote the entire filter expression. (among other things)


        "Tcf_id = "some_value_here""

        Now you have to tell Alpha how to handle the interior quotes (red). You also have to place the variable where the static value was and concatenate (+) the pieces before and after the static value.
        There can be only one.

        Comment


          #5
          Re: Filter issue

          Thanks Stan,

          I looked at the filter in the single report, applied that to the script and it works.
          The filter is:
          query.filter = "facility->Tfc_Id=\"f1\""
          The constant value f1 needs to be replaced by the variable in "lijst".

          So the filter would need to be something like:
          query.filter = "Facility->Tfc_Id=\" + lijst + "\""
          I keep getting either an error when saving or an incorrect result in the debugger. Looks like either one " too much or not enough.

          According to your explanation one more " is needed at the beginning but that produces an error when saving.
          I don't know how to solve this.
          Your help would be much appreciated.

          Thanks
          Jo Hulsen
          Dommel Valley Solutions
          The Netherlands

          Comment


            #6
            Re: Filter issue

            Jo, you're close. Stay curious.

            The help file topic "Writing Expressions" will be helpful in explaining what you are seeing.

            -- tom

            Comment


              #7
              Re: Filter issue

              query.filter = "facility->Tfc_Id=\"f1\""
              First transformation: Stop the filter string just before the literal value and restart it after.

              query.filter = "facility->Tfc_Id="\"f1\"""

              Second transformation: concatenate the three pieces.

              query.filter = "facility->Tfc_Id="+\"f1\"+""

              Third transformation: replace the literal value with the variable. Since the literal is quoted, so must the variable's value.

              query.filter = "facility->Tfc_Id="+quote(var->lijst)+""

              In this case the trailing +"" is trivial and can be removed. If we were continuing with more filter criteria you might use it such as

              query.filter = "facility->Tfc_Id="+quote(var->lijst)+" .and. myage = 59"


              So this

              query.filter = "facility->Tfc_Id="+quote(var->lijst)

              or

              query.filter = "tbl.Tfc_Id="+quote(var->lijst)

              depending on the context, should be what you want.
              There can be only one.

              Comment


                #8
                Re: Filter issue

                deleted. Stan got to it.
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment


                  #9
                  Re: Filter issue

                  Stan,


                  Thanks very muchs for this.
                  The query filter seems to need a qualified table name, don't know why but that doesn't really matter to me.
                  query.filter = "facility->Tfc_Id="+quote(var->lijst)+" .and. myage = 59+1"

                  Thanks again,
                  Jo Hulsen
                  Dommel Valley Solutions
                  The Netherlands

                  Comment


                    #10
                    Re: Filter issue

                    Originally posted by Mike Wilson View Post
                    deleted. Stan got to it.
                    Mike,

                    That's correct. tried your solution but the table name seems to be a requirement.

                    Thanks anyway,
                    Jo Hulsen
                    Dommel Valley Solutions
                    The Netherlands

                    Comment


                      #11
                      Re: Filter issue

                      Originally posted by Tom Cone Jr View Post
                      Jo, you're close. Stay curious.

                      The help file topic "Writing Expressions" will be helpful in explaining what you are seeing.

                      -- tom
                      Tom,

                      Thanks for your support.
                      Stan has kindly provided a solution. I will out of curiousity need to have a good look at that topic anyway.
                      Next challenge is to store pfd reports and upload them to a website. All in that same routine. Must be working later today!
                      Simply putting a bit of pressure on myself!

                      Regards,
                      Jo Hulsen
                      Dommel Valley Solutions
                      The Netherlands

                      Comment


                        #12
                        Re: Filter issue

                        Glad we helped but as Tom noted, "The help file topic "Writing Expressions" will be helpful in explaining what you are seeing."

                        Do you understand the process, at least in part? This topic is a vital part of employing the behind the scenes power in Alpha.

                        What if your variable had been date type? Maybe a mix of date and character and logical types? I jumped the gun a bit leading you to the answer where Tom was trying to direct you to the explanation of the process.

                        Aside from the cited section of the help files the important thing to remember is that you are constructing a filter string. A string is composed of characters. To construct the proper filter string using variables you must convert those variable's values to character equivalents and incorporate them in the string. Doing that means you must break apart the literal portions of the filter so you can insert references to the variables. Merely inserting the variable's name in the string doesn't tell Alpha that you don't mean the characters "myvariablename".
                        There can be only one.

                        Comment


                          #13
                          Re: Filter issue

                          Stan,

                          As I wrote to Tom my curiousity hasn't ended.

                          I do understand the process in general but also have to admit that more study on this topic is defenitely required to gain more knowledge about the details of writing expressions.

                          Never too old to learn!

                          Thanks,
                          Jo Hulsen
                          Dommel Valley Solutions
                          The Netherlands

                          Comment

                          Working...
                          X