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

Search Grid On A Desktop Form

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

    #16
    Re: Search Grid On A Desktop Form

    If v_custid is a character type then you can't directly test for >=0

    if var->v_custid >= 0
    filt = filt + "cust_id = "+alltrim(str(var->custid))
    end if

    you need to test the value of the variable
    if val(var->v_custid) >= 0

    Actually you probably want to test for

    if val(var->v_custid) >= 120000
    There can be only one.

    Comment


      #17
      Re: Search Grid On A Desktop Form

      Just implemented your code and it works great!

      What modifications will I need to make to apply this to a date field?

      Comment


        #18
        Re: Search Grid On A Desktop Form

        You're probably going to use two dates and filter for records in the range between them?
        dt1 is the first date variable, dt2 is the second datevariable, and date_field is your date field name to filter on.

        if isdate(dtoc(var->dt1)) .and. isdate(dtoc(var->dt2)) .and. (var->dt2>var->dt1)
        filt = filt + " .and. between(date_field,"+s_quote(var->dt1)+","+s_quote(var->dt2)+")"
        end if
        There can be only one.

        Comment


          #19
          Re: Search Grid On A Desktop Form

          I actually only need to search for one date.

          my variable is v_rpurch and my date field is purch_date.

          Would I be right in say my code should look like this?

          if isdate(dtoc(var->v_rpurch))
          filt = filt + "purch_date= "+ s_quote(var->v_rpurch)
          end if

          Comment


            #20
            Re: Search Grid On A Desktop Form

            Close. Assuming you declare the variable v_rpurch = {}

            if isdate(dtoc(var->v_rpurch)) .and. var->v_rpurch > {}
            filt = filt + ".and. purch_date= "+ s_quote(var->v_rpurch)
            end if
            There can be only one.

            Comment


              #21
              Re: Search Grid On A Desktop Form

              Thanks for your help again!

              Comment


                #22
                Re: Search Grid On A Desktop Form

                Hi Stan

                Sorry to bother you again, but I came across several issues that I can't resolve.

                In the code listed below the first search criteria "svc_id" is a numeric value and the rest are characters. With this code I can search for the svc_id, but all of the other fields return no results. If I delete the svc_id search criteria then the other search fields work normally. Is there something wrong with my code that prevents searching multiple field types?

                Also, I can not search using more than one field at a time. Is there away to allow the user to enter multiple search fields?

                Code:
                filt = ""
                if val(var->v_sservid) >= 0
                filt = filt + "svc_id = "+alltrim(str(var->v_sservid))
                end if
                if var->v_sinstall > ""
                filt = filt + quote(var->v_sinstall) +" $ Svc_instal"
                end if
                if var->v_srate > ""
                filt = filt + quote(var->v_srate ) +" $ svc_ratng"
                end if
                if var->v_scomp > ""
                filt = filt + quote(var->v_scomp) +" $ svc_nme"
                end if
                if var->v_saddr1 > ""
                filt = filt + quote(var->v_saddr1) +" $ svc_add1"
                end if
                if var->v_saddr2 > ""
                filt = filt + quote(var->v_saddr2) +" $ svc_add2"
                end if
                if var->v_sunit > ""
                filt = filt + quote(var->v_sunit) +" $ svc_unit"
                end if
                if var->v_scity > ""
                filt = filt + quote(var->v_scity) +" $ svc_city"
                end if
                if var->v_sstate > ""
                filt = filt + quote(var->v_sstate) +" $ svc_state"
                end if
                if var->v_szip > ""
                filt = filt + quote(var->v_szip) +" $ svc_zip"
                end if
                if var->v_scountry > ""
                filt = filt + quote(var->v_scountry) +" $ svc_cntry"
                end if
                if var->v_stel1 > ""
                filt = filt + quote(var->v_stel1) +" $ s_off_tel"
                end if
                if var->v_semail > ""
                filt = filt + quote(var->v_semail ) +" $ s_email"
                end if
                if var->v_stype > ""
                filt = filt + quote(var->v_stype ) +" $ svc_typ"
                end if
                filt = ltrim(filt," .and. ")
                parentform.QueryRun(filt)

                Comment


                  #23
                  Re: Search Grid On A Desktop Form

                  Haven't quite grasped the need for .and., have we?

                  Code:
                  filt = ""
                  if val(var->v_sservid) >= 0
                  filt = filt + "svc_id = "+alltrim(str(var->v_sservid))
                  end if
                  if var->v_sinstall > ""
                  filt = filt + [COLOR="#FF0000"]" .and. "+[/COLOR] quote(var->v_sinstall) +" $ Svc_instal"
                  end if
                  if var->v_srate > ""
                  filt = filt + [COLOR="#FF0000"]" .and. "+[/COLOR]quote(var->v_srate ) +" $ svc_ratng"
                  end if
                  if var->v_scomp > ""
                  filt = filt + [COLOR="#FF0000"]" .and. "+[/COLOR]quote(var->v_scomp) +" $ svc_nme"
                  end if
                  if var->v_saddr1 > ""
                  filt = filt + [COLOR="#FF0000"]" .and. "+[/COLOR]quote(var->v_saddr1) +" $ svc_add1"
                  end if
                  if var->v_saddr2 > ""
                  filt = filt + [COLOR="#FF0000"]" .and. "+[/COLOR]quote(var->v_saddr2) +" $ svc_add2"
                  end if
                  if var->v_sunit > ""
                  filt = filt + [COLOR="#FF0000"]" .and. "+[/COLOR]quote(var->v_sunit) +" $ svc_unit"
                  end if
                  if var->v_scity > ""
                  filt = filt + [COLOR="#FF0000"]" .and. "+[/COLOR]quote(var->v_scity) +" $ svc_city"
                  end if
                  if var->v_sstate > ""
                  filt = filt +[COLOR="#FF0000"] " .and. "+[/COLOR]quote(var->v_sstate) +" $ svc_state"
                  end if
                  if var->v_szip > ""
                  filt = filt + [COLOR="#FF0000"]" .and. "+[/COLOR]quote(var->v_szip) +" $ svc_zip"
                  end if
                  if var->v_scountry > ""
                  filt = filt +[COLOR="#FF0000"] " .and. "+[/COLOR]quote(var->v_scountry) +" $ svc_cntry"
                  end if
                  if var->v_stel1 > ""
                  filt = filt +[COLOR="#FF0000"] " .and. "+[/COLOR]quote(var->v_stel1) +" $ s_off_tel"
                  end if
                  if var->v_semail > ""
                  filt = filt +[COLOR="#FF0000"] " .and. "+[/COLOR]quote(var->v_semail ) +" $ s_email"
                  end if
                  if var->v_stype > ""
                  filt = filt +[COLOR="#FF0000"] " .and. "+[/COLOR]quote(var->v_stype ) +" $ svc_typ"
                  end if
                  filt = ltrim(filt," .and. ")
                  parentform.QueryRun(filt
                  There can be only one.

                  Comment


                    #24
                    Re: Search Grid On A Desktop Form

                    Melvin, the easiest way is to use the Find by Form when multiple fields need to be searched and satisfied.
                    You don't have to use the form you have open though.
                    If there are specific fields you need to search on, suggest you create a Search Button which opens a form with only the searchable fields on it. I suspect you can do it in a Modal manner but not tried that yet.
                    Then, if the data is found, open the primary form again and scroll through the records in the query, or open the primary using a specific ID or Record number.
                    See our Hybrid Option here;
                    https://hybridapps.example-software.com/


                    Apologies to anyone I haven't managed to upset yet.
                    You are held in a queue and I will get to you soon.

                    Comment


                      #25
                      Re: Search Grid On A Desktop Form

                      Thanks Stan...That fixed the multiple search issue.

                      Unfortunately I still can't search for numeric and character values.

                      Any Ideas?

                      Comment


                        #26
                        Re: Search Grid On A Desktop Form

                        Unfortunately I still can't search for numeric and character values.
                        Not understood. Probably time for a sample database to see where the issue lies.
                        There can be only one.

                        Comment


                          #27
                          Re: Search Grid On A Desktop Form

                          Hi Stan

                          Attached is a sample database.

                          At present it will search the Servicer ID, which is a numeric field, but all other character fields will not work.

                          If i delete the below line of code, then the character fields work.

                          Code:
                          if val(var->v_sservid) >= 0
                          filt = filt + "svc_id = "+alltrim(str(var->v_sservid))
                          end if
                          Attached Files

                          Comment


                            #28
                            Re: Search Grid On A Desktop Form

                            What is the purpose of the equals sign in

                            if val(var->v_sservid) >= 0

                            ?

                            If the user enters only one of the character fields to be searched, this line still tries to build a filter using the service id since the value of a blank is zero.

                            Note: You were probably following my earlier pattern but you neglected the part about.....

                            To clear the variables reset them to blank (negative number for the creditrating). IOW your refresh button should reset any numeric variables to some negative number. Then the test for >= won't be met and the service id won't be part of the filter.
                            Last edited by Stan Mathews; 07-02-2012, 02:30 PM.
                            There can be only one.

                            Comment


                              #29
                              Re: Search Grid On A Desktop Form

                              Hmmm...I guess there is no real point to it.

                              It just allowed the search function to work for me.

                              What should the appropriate code be?

                              Comment


                                #30
                                Re: Search Grid On A Desktop Form

                                See my note in post 28. If your refresh button sets the service id to zero then you need to test for > 0 (no equals, if val(var->v_sservid) > 0).
                                If it sets service id to a negative value then you can test for >= 0.
                                There can be only one.

                                Comment

                                Working...
                                X