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

Finding a child record on a set's form

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

    #31
    Re: Finding a child record on a set's form

    Originally posted by Ray in Capetown View Post
    Blowing my own idea out the water. I just came across something I forgot I used some time back...
    This will do it all - ie locate the row in an embedded browse containing text in a column

    Code:
    browse1.fetch_first()
    browse1.locate_next(VAR->m_phrase ,"desc")
    Ray, I'm not getting the reason for the locate_next. Is this a way to speed up the search for the phrase or a way to cycle through the data to search for each occurrence of the phrase? For the users in this case, they know what they're looking for and would more than likely supply the beginning of the description rather than an embedded word or phrase. Once they arrive at that point of the alphabet, they will then see adjacent descriptions in case something else is more relevant to their needs. This approach beats the paging through a long list of products.

    The one thing that would certainly improve this would be to improve the speed when the search item is lower in the alphabet. But I'm sure they can live with the way it is. That's why I was curious to know if the a5_get_records_in_query could also work to find the record on the embedded browse. I see the distinction, however, in that this is working on the table and not the form.

    Jeff

    Comment


      #32
      Re: Finding a child record on a set's form

      Jeff
      The locate_next is an almost exact copy of the code you already used, in functionality. No advantage for what you want unless MARGINALLY faster. Just efficient coding is all. It was just a thought excercise for me, and a chance to open an idea discussion on the topic.

      While you should use the result of A5_get_records_in_query to inform the user how many matches can be found. It performs no usable query.

      Comment


        #33
        Re: Finding a child record on a set's form

        Originally posted by Ray in Capetown View Post
        Jeff
        The locate_next is an almost exact copy of the code you already used, in functionality. No advantage for what you want unless MARGINALLY faster. Just efficient coding is all. It was just a thought excercise for me, and a chance to open an idea discussion on the topic.

        While you should use the result of A5_get_records_in_query to inform the user how many matches can be found. It performs no usable query.
        Ray,

        I was playing around with the locate_next you suggested. It doesn't do anything unless it is embedded within a loop, right? Meaning, it will not search for the occurrence of the target phrase unless you tell it to cycle through each line item and perform a match. I assume this is correct since I can't get it to work without a loop.

        Jeff

        Comment


          #34
          Re: Finding a child record on a set's form

          Not right. It needs no loop. (Unless you want to continue to search for the next following occurrence/s)

          Comment


            #35
            Re: Finding a child record on a set's form

            Originally posted by Ray in Capetown View Post
            Not right. It needs no loop. (Unless you want to continue to search for the next following occurrence/s)
            Is there something more to this code that's needed? Here's the code I modified to test this and it does nothing as written:

            '>>>> insert text box to collect search phrase
            'Prompt for text and store result in a variable called 'm_phrase'.
            dim prmpt_title as c
            dim prmpt_prompt as c
            dim prmpt_default as c

            prmpt_title = "What product?"
            prmpt_prompt = a5_eval_expression("=\"What phrase in the product description do you want to find\"",local_variables())
            prmpt_default = ""

            DIM SHARED m_phrase AS C

            m_phrase = trim(upper(ui_get_text(prmpt_title,prmpt_prompt,prmpt_default)))


            if a5_get_records_in_query("msprod",s_quote(m_phrase)+" $ desc")>0
            m_phrase=upper(m_phrase) 'be sure search fragment is upper case
            parentform:browse1.Fetch_First()
            browse1.locate_next(VAR->m_phrase ,"desc")


            ' cnt=parentform.lines.value
            ' if cnt>0
            ' for i = 1 to cnt
            ' current=upper(msprod->desc) 'be sure field to compare is upper case
            ' if trim(var->m_phrase)$current 'test for presence of phrase in product description
            ' end ' found match stops on that "record"
            ' end if
            ' if i<cnt
            ' parentform:browse1.Fetch_Next() 'don't overshoot
            ' end if
            ' next i
            ' end if
            else
            ui_msg_box("NOT FOUND","The search phrase you are using does not find a match. ",64)
            end if

            Comment


              #36
              Re: Finding a child record on a set's form

              It works as published - in a form or browse
              I just set up a test with an embedded browse as you are using.
              In that it doesn't seem to like the field specified.
              Try this, load the only form. You don't need to worry about case.
              Attached Files

              Comment


                #37
                Re: Finding a child record on a set's form

                Originally posted by Ray in Capetown View Post
                It works as published - in a form or browse
                I just set up a test with an embedded browse as you are using.
                In that it doesn't seem to like the field specified.
                Try this, load the only form. You don't need to worry about case.
                I did a quick try and of course your test app works. I'll need to look at this later and compare to mine as to where there is a difference. Thanks.

                Jeff

                Comment


                  #38
                  Re: Finding a child record on a set's form

                  Code:
                  [COLOR="#FF0000"]topparent:Browse1:Desc.activate()[/COLOR]
                  topparent:Browse1.Fetch_First()
                  topparent:Browse1.locate_next(rslt)
                  Might it be that yours doesn't put the field to be tested into focus?
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #39
                    Re: Finding a child record on a set's form

                    Originally posted by Jeff Fried View Post
                    I did a quick try and of course your test app works. I'll need to look at this later and compare to mine as to where there is a difference. Thanks.

                    Jeff
                    Ray,

                    The reason yours works is you have the following lines:

                    browse1.fetch_first()
                    browse1.locate_next(trim(VAR->m_phrase))

                    Whereas, you originally published:

                    browse1.fetch_first()
                    browse1.locate_next(VAR->m_phrase ,"desc")

                    That second argument for the browse1.locate_next is not needed and, as far as I can see, doesn't allow it to work.

                    Also, by the way, the speed improvement is significant vs. your original looping approach. So thanks for the extra effort.

                    Jeff

                    Comment


                      #40
                      Re: Finding a child record on a set's form

                      Originally posted by Mike Wilson View Post
                      Code:
                      [COLOR="#FF0000"]topparent:Browse1:Desc.activate()[/COLOR]
                      topparent:Browse1.Fetch_First()
                      topparent:Browse1.locate_next(rslt)
                      Might it be that yours doesn't put the field to be tested into focus?
                      Mike,

                      Thanks for your input on activating the object. There are a couple things to note. Here is how I ended up, which works properly:

                      browse1.Fetch_First()
                      browse1.locate_next(VAR->m_phrase)
                      browse1:product description.activate()

                      The "topparent" reference was not necessary. Second, the "activate" comes after the locate_next since you want to finish with the focus on the line item. Third, the object to activate is the title of the column "Product Description" and not a field name such as "desc".

                      Thanks again.

                      Jeff

                      Comment


                        #41
                        Re: Finding a child record on a set's form

                        To summarize what this does and how it works, for anyone interested:

                        Objective: click on a button (or use assigned keyboard shortcut) to find an item on an embedded browse that meets the search criteria, in this case containing a word or phrase within a product description that the user indicates. This is in lieu of having the ability to find by an index key in a child object.

                        Code on the button:

                        ***

                        dim prmpt_title as c
                        dim prmpt_prompt as c
                        dim prmpt_default as c

                        prmpt_title = "What product?"
                        prmpt_prompt = a5_eval_expression("=\"What phrase in the product description do you want to find\"",local_variables())
                        prmpt_default = ""

                        DIM SHARED m_phrase AS C

                        m_phrase = trim(upper(ui_get_text(prmpt_title,prmpt_prompt,prmpt_default)))

                        if a5_get_records_in_query("msprod",s_quote(m_phrase)+" $ desc")>0
                        m_phrase=upper(m_phrase) 'be sure search fragment is upper case
                        browse1.Fetch_First()
                        browse1.locate_next(VAR->m_phrase)
                        browse1:product description.activate()
                        else
                        ui_msg_box("NOT FOUND","The search phrase you are using does not find a match. ",64)
                        end if

                        ***

                        I hope the above code indents properly. Sometimes it does not and looks confusing. This works well, and I will have many applications for this approach.

                        Thanks all who contributed.

                        Comment


                          #42
                          Re: Finding a child record on a set's form

                          Originally posted by Mike Wilson View Post
                          Code:
                          [COLOR="#FF0000"]topparent:Browse1:Desc.activate()[/COLOR]
                          Might it be that yours doesn't put the field to be tested into focus?
                          wouldn't have occurred to me ever.
                          Thanks

                          Tried it - nope thats not it
                          Last edited by Ray in Capetown; 08-01-2012, 05:36 AM. Reason: Tried

                          Comment


                            #43
                            Re: Finding a child record on a set's form

                            Quick Sample.
                            Browse_Search.zip
                            Last edited by G Gabriel; 08-03-2012, 08:27 AM.

                            Comment

                            Working...
                            X