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

Find by key, using index built up on 2 fields

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

    Find by key, using index built up on 2 fields

    Hi,
    I'm trying to use the find by key action script to do a find on an index which is built up from two fields; "firstname" and "lastname"
    I input variables via a dialog box, but I don't see how to use both the variables to do the search on the table.

    Brian.

    #2
    RE: Find by key, using index built up on 2 fields

    Brian:
    I have pasted the sample from the help.chm. I added the second field to the search.

    "tbl".fetch_find():

    dim tbl_product as P
    dim indx_1 as P
    tbl_product = table.open("c:\data\product.dbf")
    indx_1 = tbl_product.index_primary_put("id_index")
    rec = tbl_product.fetch_find(inv_item-"product_id+inv_item-"Field2)
    if (rec " 0) then
    on_hand = tbl_product.qty_stock
    end if
    tbl_product.close()

    I hope this helps.

    bob adler

    Comment


      #3
      RE: Find by key, using index built up on 2 fields

      Hi Bob,
      Thanks for the response.
      I was hoping that I am missing something, and that it can be done simply with action scripting. It must be a fairly common situation ?

      Brian.

      Comment


        #4
        RE: Find by key, using index built up on 2 fields

        Yes, it's fairly commonplace. The Find by Key "Action" will permit you to define the search key using an "expression". Since you can't use a single variable and must combine them, use the "expression" option and specify

        var1 + var2

        as the expression. The expression must evaluate to the same expression used to define the index key in the table. This can be a bit tricky sometimes so let us know how it goes. Spare no details.

        -- tom

        Comment


          #5
          RE: Find by key, using index built up on 2 fields

          Brian:

          Attached file based on Customer.dbf in Alpha Sports. The script named Brian contains a search based on two fields input using variables.
          The search is not calling the index directly but it is using two variables. I can't confirm if Alpha is using the Index.

          The second is the one that comes with alpha sports.

          I hope this helps.

          Comment


            #6
            RE: Find by key, using index built up on 2 fields

            Hi Tom,
            It seems that in this kind of expression the field length is important.
            I can't get it to work from inputing two variables normally.
            Using manually "find by key" on a "lastname"+"firstname" index, on a test form, it leaves a space after the lastname input, before the firstname input, which seems to correspond to the length of the lastname field. If I respect that spacing, (my input + spaces = field length), then the find goes ok; otherwise not.

            So, maybe I need an expression which limits the maximum input on each variable to the length of the field ( not normally a problem) and fills in any spaces to make the total of the input+spaces to be that of the field length.

            Does that make any sense, if so would appreciate any simple, if possible, suggestions.

            Thanks for your help.
            Brian.

            Comment


              #7
              RE: Find by key, using index built up on 2 fields

              Brian,

              DBF tables use fixed width fields for character and numeric data.

              If your lastname field is 20 wide, and you input "Smith", the actual field value is "Smith" plus 15 blank spaces. This means if you define an index as Lastname + Firstname, Alpha uses the entire field width for both Lastname and Firstname in the index key. You wind up with something like:

              "pre"
              "SMITH JOHN "
              "/pre"

              This is the index key for a Lastname + Firstname index.

              A common solution to this is to trim blank spaces in the index definition:

              trim(Lastname) + trim(firstname)

              So the new index search key would be:

              SMITHJOHN

              This might work well for you here.

              -- tom

              Comment


                #8
                RE: Find by key, using index built up on 2 fields

                Brian,

                DBF tables use fixed width fields for character and numeric data.

                If your lastname field is 20 wide, and you input "Smith", the actual field value is "Smith" plus 15 blank spaces. This means if you define an index as Lastname + Firstname, Alpha uses the entire field width for both Lastname and Firstname in the index key. You wind up with something like:

                Code:
                "SMITH               JOHN          "
                This is the index key for a Lastname + Firstname index.

                A common solution to this is to trim blank spaces in the index definition:

                trim(Lastname) + trim(firstname)

                So the new index search key would be:

                SMITHJOHN

                This might work well for you here.

                -- tom

                Comment


                  #9
                  RE: Find by key, using index built up on 2 fields

                  Hi Tom,
                  Yes, you are correct. That was the way to do it.

                  Now I have to throw in the problem of accented letters on the index, but I'll start in on that next week. I need to do some searching on this board for that info.

                  Thanks,

                  Brian

                  Comment

                  Working...
                  X