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

Script Variables in Range Settings

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

    Script Variables in Range Settings

    Hi
    I have a dialog script which stores two variables, %prod1 and %prod2.
    I have a report with a range setting, in which I have specified the First Record as {%prod1} and the Last Record as {%prod2}.
    On running the report I get an error message "No valid records in current range".

    If I change the range by replacing the script variables with actual values and re-run the report, it's fine, so I assume it's something to do with the way I have specified those variables in the range.

    Any ideas please? The manuals don't seem to cover the use of script variables in range settings.

    (Question was originally posted in the A4v6 section but no replies received, so I thought I'd try this section instead - it seems more widely used!)

    #2
    RE: Script Variables in Range Settings

    Paul,

    The first and last records must be the actual key values, not a key value stored in a variable. If you want to have the variables used in the range settings, you will have to have the macro move to the 1st and last key fields and put the variable name surrounded by curly french braces at that point in the code, as in

    I
    R
    {DN}
    A
    A
    {%variable1st}{ENTER}
    {%variableend}{ENTER}
    {F10}

    Regards,

    Ira
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture


    Comment


      #3
      RE: Script Variables in Range Settings

      Thanks Ira, for that fast response, it's much appreciated.

      From what you suggest, it's ok to use the variable name (in curly braces) at print time, but not when originally defining the range settings. Is that correct? Seems to me that either way ought to work.

      After all, when I specify the range settings in advance, I am simply specifying {%variable1st} as the start value. Doesn't this simulate actually typing the contents of that variable into the "First" key field?

      Maybe I am missing something here...it's been terribly hot here in the UK these last few days... :-)

      Regards
      Paul

      Comment


        #4
        RE: Script Variables in Range Settings

        Paul,

        When a variable with curly brac es in found in a macro, it's current contents at the time of the macro are typed in at that point as if you were typing in yourself. If you put it the key position with the {%varname}, it looks for a key with those characters, { % v a r n a m e }, not SMITHJOHN or whatever.

        Regards,

        Ira
        Regards,

        Ira J. Perlow
        Computer Systems Design


        CSDA A5 Products
        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
        CSDA Barcode Functions

        CSDA Code Utility
        CSDA Screen Capture


        Comment


          #5
          RE: Script Variables in Range Settings

          Ira,

          Ah, I see now.

          It doesn't make that clear in the manuals, but I cannot expect the authors to think of every scenario.
          I will avoid setting the range in advance, and will amend the macro in the way you suggest.

          The manual does actually state that enclosing a variable in curly braces is the same as actually typing the contents of the variable in yourself - that's what misled me.
          Thank you for clarifying it for me.

          Regards
          Paul

          Comment


            #6
            RE: Script Variables in Range Settings

            Hi Ira

            Well, that worked a treat, thank you, except that now when I specify a range of key values for the report, the resulting printout misses out the last value and all its associated data results.

            To clarify, I put the first key as CF01 and the last key as CF05, but the only results printed are CF01 to CF04 inclusive.

            What happened to CF05?

            Regards
            Paul

            Comment


              #7
              RE: Script Variables in Range Settings

              Paul,

              The last record key is the highest key that will be included in a range. CF05 will take you to CF05 with no trailing spaces for the key. CF05SMITH would take you to the smiths, assuming your key is ID+LASTNAME. To get to the last key in a range, append a tilde (~) which has a large ASCII value to the last key as in;

              I
              R
              {DN}
              A
              A
              {%variable1st}{ENTER}
              {%variableend}~{ENTER}
              {F10}

              Regards,

              Ira
              Regards,

              Ira J. Perlow
              Computer Systems Design


              CSDA A5 Products
              New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
              CSDA Barcode Functions

              CSDA Code Utility
              CSDA Screen Capture


              Comment


                #8
                RE: Script Variables in Range Settings

                Yet another amazingly fast response - thank you.

                The field in question is a partnumber field and has only 4 characters. The index in use is the partnumber index, and CF01 and CF05 are both complete field values.

                I tried the tilde anyway but it made no difference, though I can see why you suggested it, not knowing the field was only 4 chars. The problem seems to be in the range-setting area, because leaving the range as and causes the report to print all the records including the last.

                Regards
                Paul

                Comment


                  #9
                  RE: Script Variables in Range Settings

                  Sorry - a typo. Last para should say

                  The problem seems to be in the range-setting area, because leaving the range as FIRST and LAST (with angle brackets, which this board seems to strip out) causes the report to print all the records including the last.

                  Comment


                    #10
                    RE: Script Variables in Range Settings

                    Paul,

                    Try a last key of CF06 or CF0~ as the value

                    Regards,

                    Ira
                    Regards,

                    Ira J. Perlow
                    Computer Systems Design


                    CSDA A5 Products
                    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                    CSDA Barcode Functions

                    CSDA Code Utility
                    CSDA Screen Capture


                    Comment


                      #11
                      RE: Script Variables in Range Settings

                      CF06 produces a report ending at CF05.
                      CF0~ produces a report ending at CF08, which is the last record in the range.

                      Comment


                        #12
                        RE: Script Variables in Range Settings

                        Ira,

                        Trouble is, although the tilde would work for some instances, most times there is a need to run the report for just a couple or so consecutive key values within a range, e.g. CF03 to CF04. It's not very practical to enter the next value after the range we need, just to get the thing to work properly.

                        The "First" value bit of the range settings works fine. The "Last" bit doesn't. I know it's unlikely to be an A4 bug, but I have stripped the app right down for testing and it still does it.

                        You think alcohol might help?

                        Regards
                        Paul

                        Comment


                          #13
                          RE: Script Variables in Range Settings

                          Paul,

                          I'm not sure why your having trouble, but create the index with an expression like ID+" "

                          Then use the tilde after the ID in the last key and that will work.

                          Regards,

                          Ira
                          Regards,

                          Ira J. Perlow
                          Computer Systems Design


                          CSDA A5 Products
                          New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                          CSDA Barcode Functions

                          CSDA Code Utility
                          CSDA Screen Capture


                          Comment


                            #14
                            RE: Script Variables in Range Settings

                            Ira,

                            I worked on this til 1am (commitment or stupidity, I don't know which...) and eventually arrived at the same conclusion. It worked fine.

                            Actually if I take Alpha's "invoicing" app which came as part of their applications pack, the same problem appears there too. Maybe I was wrong before - maybe it is a minor bug after all. My relatively limited past programming experience in Basic/C/C+ has shown me before that the first and last records in a sort can be problematical. Never mind, there's always a workaround!

                            Thanks for your kind help - really appreciated.

                            Regards
                            Paul

                            Comment

                            Working...
                            X