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

Create a search

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

    Create a search

    Hello all,

    I wonder if someone can help. I have set-up my forms which look great. Next I want to create a custom search, but I am not sure where to start :o.

    I have found the query button by form, which is near to what I would like - but not quite. I have a form with my clients on it and I want users to be able to search on about 4 of these fields using a single field at a time.

    My forms work in a read only mode as standard as this is what the users are are used to. I was going to treat the search as a similar type of mode. Have a button put the form into query mode, and enable the cancel button. In order to do this I would need some form of OK button, but I can not find a command that can do this - am I missing something or does someone know of a better way to do this possibly using the record list type)?

    Thanks all.
    Wise Alpha once said said to me...
    ..."Change must begin first."

    #2
    Re: Create a search

    Take a look at creating an xdialog. The genie should get your design done quickly, then convert it to xbasic and add a bit of code.
    There can be only one.

    Comment


      #3
      Re: Create a search

      Originally posted by RevMK View Post
      In order to do this I would need some form of OK button, but I can not find a command that can do this - am I missing something or does someone know of a better way to do this possibly using the record list type)?
      What do you want the OK button to do? Return a record? Compile a value? Run a script?

      kenn
      TYVM :) kenn

      Knowing what you can achieve will not become reality until you imagine and explore.

      Comment


        #4
        Re: Create a search

        Hi,

        I'd like it to return a value. I've taken a look at the xdialog, and see it sets variables. However I am not sure exactly what to do next, as even with the variables I am not sure how to have main form return the result.

        Thanks
        Wise Alpha once said said to me...
        ..."Change must begin first."

        Comment


          #5
          Re: Create a search

          I am not sure how to have main form return the result.
          convert it to xbasic and add a bit of code.
          Once the xdialog is created and the variables set, convert it to xbasic. You can then add code to

          check to see if the main form is open (should always be, good to check)
          query the form for the proper records per the variables
          There can be only one.

          Comment


            #6
            Re: Create a search

            Originally posted by RevMK View Post
            Hi,

            I'd like it to return a value. I've taken a look at the xdialog, and see it sets variables. However I am not sure exactly what to do next, as even with the variables I am not sure how to have main form return the result.

            Thanks
            Another question: You do the search, find the record (value, i.e. last name), do you want to see certain fields for the last name such as address, phone, etc.? If so, you can use action scripting to open a form which contain the fields you wan to se and use another action script to Find by... I don't have A5 on this computer so I don't know the exact one but try a few of the and see what happens.

            If you could post a zip file with a complete explanation, we can look at we would have a better idea.

            kenn
            TYVM :) kenn

            Knowing what you can achieve will not become reality until you imagine and explore.

            Comment


              #7
              Re: Create a search

              Hi,

              Thanks for the replied. I think this is what I want to do.

              1) As there is a possibility one or more results may be returned by the search, I want 3 possible fields to search on.
              2) The results of this 'search' should then populate a list box.
              3) The user can then select the line in the list for the record they want, double click and jump to it.

              So this raises the following questions;
              1) Is it possible to create a form which is not based upon any table?
              2) Is it possible to populate a list box based on the results of a query?

              Thanks
              Wise Alpha once said said to me...
              ..."Change must begin first."

              Comment


                #8
                Re: Create a search

                Originally posted by RevMK View Post
                Hi,

                Thanks for the replied. I think this is what I want to do.

                1) As there is a possibility one or more results may be returned by the search, I want 3 possible fields to search on.
                2) The results of this 'search' should then populate a list box.
                3) The user can then select the line in the list for the record they want, double click and jump to it.

                So this raises the following questions;
                1) Is it possible to create a form which is not based upon any table?
                2) Is it possible to populate a list box based on the results of a query?

                Thanks
                Alpha Five is very flexible in that there are usually 2 or more ways to accomplish a task but here's what I would try. I suggest this because it will help you become familiar with action scripting which is a huge blessing for those new to A5 and old timers as well. It's a great place for you to start.

                I would create a form which contains whatever fields you want the user to search. Then, I would create a browse which contain the fields you want the user to view. The browse would have an Onrow Double Click event which would take the user to another form which contain the necessary fields/information.

                Instead of using a query, you could also use a Find by Form which is similar to Query by Form but you do not have to use the Show All function to show all records after the query.

                There are other Find methods which can be used, it just depends on your situation. It would be a good for you to review the various ways to search, query and find information.

                Answers to Questions

                1: No, A form can be based on a set but the set contains 2 or more tables.

                2: While I don't have a ready approach for you to use, I'd be surprised if it couldn't.
                TYVM :) kenn

                Knowing what you can achieve will not become reality until you imagine and explore.

                Comment


                  #9
                  Re: Create a search

                  Additionally, when I have a situation like yours, I search the message board to see what others have asked about the subject. Quite often someone has posted a zip file which I adapt to my needs.

                  In A5 Help, in the Contents tab, there are a ton of tutorials, several on Finding, Searching and querying records.

                  As you can see, time spent reading and trying different methods will be the answer to you situation.

                  kenn
                  TYVM :) kenn

                  Knowing what you can achieve will not become reality until you imagine and explore.

                  Comment


                    #10
                    Re: Create a search

                    I this something like you wanted? It has a dynamic modeless dialog to perform a serial selection of a field and then the field values. Close?
                    Last edited by Mike Wilson; 11-10-2010, 02:54 PM.
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: Create a search

                      I've posted this one before, but I'll post it again. We have a Customer Information system where we need to search for customers by a variety of keys or fields. In some of the instances, we will display a number of customers that would match the search criteria, and let the user select the appropriate one based on displayed information. I don't expect you to go quite this heavily into it, but you might take it as an example and see what you will come up with. Examples of the dialog box is in the following thread: http://msgboard.alphasoftware.com/al...ad.php?t=90196

                      Code:
                      'Date Created: 04-May-2007 03:32:36 PM
                      'Last Updated: 26-Oct-2010 07:29:41 PM
                      'Created By  :
                      'Updated By  : 
                      retry1:
                      dim aa as P
                      aa = addin.variables()
                      DIM SHARED search_by as C
                      DIM SHARED varC_result as C
                      Dim Shared SSNN as C
                      Dim shared Caseno as C
                      Dim SHARED FNAME as C
                      DIM SHARED Int as C
                      Dim Shared LName as C
                      DIM Shared LNAME2 as C
                      Dim Shared DOB as D
                      Dim SHARED FLNAME as C
                      Dim wordct as N
                      Int = ""
                      SSNN = ""
                      Caseno = ""
                      FNAME = ""
                      LName = ""
                      LNAME2 = ""
                      search_by="Last Name 1st Initial"
                      '*****************
                      'initialize dob
                      'added by hubert
                      dob={}
                      '*****************
                      tbl = table.GET("client")
                      ok_button_label = "&OK"
                      cancel_button_label = "&Cancel"
                      varC_result = ui_dlg_box("Client Search",<<%dlg%
                      {region}Please Select Search Type:{endRegion};
                      {region}
                      (search_by:Case!radio2_)|
                      (search_by:SSN!radio1_);
                      {condition=(tbl.name_get()<>"Link")}
                      (search_by:Last Name!radio4_)|
                      (search_by:Full Name!radio3_)|(search_by:Last, First, DOB!radio7_);
                      (search_by:Last Name 1st Initial!radio5_)|
                      (search_by:Investigations!radio6_);
                      {condition=.T.}
                      {endregion};
                      {condition=(search_by="SSN")}
                      {region=a}
                      {LF}; 
                      Please Enter Client's SSN:| [.20SSNN];
                      {endregion}
                      {condition=(search_by="Case")}
                      {start_pos}
                      {region=a}
                      {LF};
                      Please Enter Client's Case #:| [.15Caseno];
                      {endregion}
                      {condition=(search_by="Last Name")}
                      {start_pos}
                      {region=a}
                      {LF};
                      Please Enter Client's Last Name:|[.25LName];
                      {endregion}
                      {condition=(search_by="Full Name")}
                      {start_pos}
                      {region=a}
                      {LF};
                      Please Enter Client's First Name:|[.20FNAME];
                      Please Enter Client's Last Name:|[.25LName];
                      {endregion}
                      {condition=(search_by="Last Name 1st Initial")}
                      {start_pos}
                      {region=a}
                      {LF};
                      Please Enter Client's First Initial:|[.2INT];
                      Please Enter Client's Last Name:|[.25LName];
                       Other Last Name or Maiden Name:|[.25LNAME2]   - Optional;
                      Please Enter Client's Date of Birth:|[%DATE%.15DOB]   - Optional;
                      {endregion}
                      {condition=(search_by="Last, First, DOB")}
                      {start_pos}
                      {region=a}
                      Please Enter Client's First Name:|[.20FNAME1];
                      Please Enter Client's Last Name:|[.25LName];
                      Please Enter Client's Date of Birth:|[%DATE%.15DOB];
                      {endregion}
                      {condition=(search_by="Investigations")}
                      {start_pos}
                      {region=a}
                      Please Enter Client's Street Address:|[.30ADDR];
                      Please Enter Client's City:|[.25CITY];
                      Please Enter Client's State|[.4STATE];
                      {endregion};
                      {condition=.T.}
                      {line=1,0};
                      {region}
                      <*15=ok_button_label!OK?.not.(search_by="")> <15=cancel_button_label!CANCEL>
                      {endregion};
                      %dlg%,<<%code%
                      if left(a_dlg_button,7) = "radio1_" then
                         ui_dlg_ctl_goto("Client Search","SSNN")
                         a_dlg_button=""
                      end if
                      if left(a_dlg_button,7) = "radio2_" then
                         ui_dlg_ctl_goto("Client Search","Caseno")
                         a_dlg_button=""
                      end if
                      if left(a_dlg_button,7) = "radio3_" then
                         ui_dlg_ctl_goto("Client Search","FNAME")
                         a_dlg_button=""
                      end if
                      if left(a_dlg_button,7) = "radio4_" then
                         ui_dlg_ctl_goto("Client Search","LNAME")
                         a_dlg_button=""
                      end if
                      if left(a_dlg_button,7) = "radio5_" then
                         ui_dlg_ctl_goto("Client Search","INT")
                         a_dlg_button=""
                      end if
                      if left(a_dlg_button,7) = "radio6_" then
                         ui_dlg_ctl_goto("Client Search","ADDR")
                         a_dlg_button=""
                      end if
                      if left(a_dlg_button,7) = "radio7_" then
                         ui_dlg_ctl_goto("Client Search","FNAME1")
                         a_dlg_button=""
                      end if
                      %code%)
                      if varC_result= "CANCEL"
                      	ui_msg_box(Agency+" Client Search","Action Cancelled at user request")
                      	end
                      end if
                      debugcheck()
                      if search_by="Case"
                      	if tbl.name_get() = "Client"
                      		'this is the Client Set, get the ssn from the link table
                      		tbl2 = table.open("link")
                      		tbl2.index_primary_put("case")
                      		rec = tbl2.fetch_find(padr(ut(caseno),12," "))
                      		dim casenod as C
                      		casenod = ""
                      		if rec <1
                      			tbl2.index_primary_put("last6")
                      			rec = tbl2.fetch_find(right(trim(caseno),6))
                      			if rec <1 .or. tbl2.is_deleted()
                      				ui_msg_box(agency+" Client Search","Case Number "+ut(caseno)+" does not exist in Client Information"+chr(13)+"Please check the case # entered and retry")
                      				goto retry1
                      			end if
                      		end if
                      		ssnn = tbl2.ssn
                      		if ut(tbl2.Case)<>ut(caseno)
                      			casenod=tbl2.case
                      		  else
                      		  	casenod = ut(caseno)
                      		end if
                      		tbl2.close()
                      		ui_msg_box(agency+" Client Search","A Client exists for Case Number "+ut(casenod)+chr(13)+"Please verify that this is the Client you are looking for")
                      		goto checksoc
                      	end if	
                      	
                      	indx_2 = tbl.index_primary_put("last6")
                      	'fetch_first(db_current())
                      	rec = tbl.fetch_find(right(trim(caseno),6))
                      	if rec > 0
                      		parentform.resynch()
                      		UI_MSG_BOX(agency+" - FIND","This is the FIRST CASE with this Number "+Upper(link->case)+chr(13)+"If this is not the one you need, hit "+chr(39)+"Page Down"+chr(39)+" until you retrieve the right one.",64)
                      	  ELSE
                      		UI_MSG_BOX(agency+" - FIND","Case Number "+ut(caseno)+" Does NOT exist in the System!"+chr(13)+"Please check the number and try again.",16)
                      		goto retry1
                      	end if
                      	end
                      TBL2.CLOSE()
                      end if	
                      if search_by="SSN" then
                      checksoc:
                      	if len(alltrim(ssnn))<>9 .and. len(alltrim(ssnn))<>11
                      		ui_msg_box(agency+" - Find","Length of SSN entered is Invalid.  Please try again.")
                      		goto retry1
                      	end if
                      	soc1=padr(trim(ssnn),13," ")	
                      '	'*******************************************************************
                      	INDX_1 = tbl.index_primary_put("ssn")
                      	rec= tbl.fetch_find(soc1)
                      	if rec > 0
                      		parentform.resynch()
                      		'Check to see if this ssn exists in someone elses  household
                      		CLSSN = lookupc("F",left(SOC1,11),"CLSSN","househol.dbf","ssn")
                      		IF CLSSN > "             " THEN
                      			clname = alltrim(lookupc("F",clssn,"FNAME","Client.dbf","ssn"))+" "+trim(lookupc("F",clssn,"lNAME","Client.dbf","ssn"))
                      			ansc =UI_MSG_BOX(agency+" - FIND","This person Also exists in the HOUSEHOLD of a Customer by the name of -  "+chr(13)+chr(13)+ut(clname)+chr(13)+chr(13)+"Do you want to display "+clname+"'s Customer's Information?",52)
                      			if ansc = 6
                      				Soc1 = clssn
                      				tbl.fetch_find(soc1)
                      				parentform.Resynch()
                      			end if			
                      		end if
                      		'*******************************************************************
                      '		parentform.Refresh_Layout() 
                      	  ELSE
                      		UI_MSG_BOX(agency+" - FIND","Customer SSN Does NOT exist in Client Info. Checking Medicaid!",16)
                      		med_file = TABLE.open(AA.BCBSS.PATH+"\medicaid\medicaid.dbf",FILE_RO_SHARED)
                      		MED_FILE.index_primary_put("ssn")
                      		FOUND=MED_FILE.fetch_fiND(SOC1)
                      		If found > 0 then
                      			ans2 = ui_msg_box(agency+" - FIND","A Client with this SSN     "+TRANSFORM(trim(ssn),"@R XXX-XX-XXXXXX")+ chr(13)+"Has been found in the MEDICAID Database "+CHR(13)+"Case Number   "+TRANSFORM(trim(MED_FILE.medicaidno),"@R XX XX XXXXXX")+CHR(13)+" Do you want to see this case?",36)	
                      			if ans2 = 6 then
                      				'display Medicaid Form
                      				dim A_FORM_CURRENT as c
                      				query.filter = "SSN = Client->ssn"
                      				query.order = ""
                      				callother("NEW FORM RETRO VIEW","\medicaid\medicaid.dbf")
                      		  	  else
                      				ui_msg_box(agency+" - FIND","A Client with this SSN - "+trim(ssn)+ chr(13)+"Does NOT Exist in the MEDICAID Database",16)	
                      			end if
                      		end if
                      		MED_FILE.close()
                      		UI_MSG_BOX(agency+" - FIND","Customer SSN Does NOT exist in System. Checking Household!",16)
                      		CLSSN = lookupc("F",SOC1,"CLSSN","househol.dbf","ssn")
                      		IF CLSSN > "             " THEN
                      			clname = alltrim(lookupc("F",clssn,"FNAME","Client.dbf","ssn"))+" "+trim(lookupc("F",clssn,"lNAME","Client.dbf","ssn"))
                      			UI_MSG_BOX(agency+" - FIND","This person Also exists in the HOUSEHOLD of a Customer by the name of -  "+chr(13)+chr(13)+ut(clname)+chr(13)+chr(13)+"Displaying "+clname+"'s Customer's Information?")
                      			soc1 = clssn
                      			tbl.fetch_find(soc1)
                      			parentform.resynch()
                      		  else
                      			UI_MSG_BOX(agency+" - FIND","Customer SSN Does NOT exist in System. Please Search by some other Key!",16)
                      			GOTO retry1
                      		end if
                      	end if
                      	end
                      end if
                      if left(search_by,4)="Full" then
                      FULLNAME:
                      debugcheck()
                      	DIM NAMES(100) as C
                      	names.clear()
                      	i = 1
                      	dim tblc as P
                      	tblc = table.open("client",FILE_RO_SHARED)
                      	fname1=TRIM(LNAME)+" "+TRIM(FNAME)
                      	fname2	= ut(FNAME)+" "+UT(LNAME)
                      	indx_2 = tblc.index_primary_put("Fullname")
                      	rec = tblc.fetch_find(FNAME1)
                      '	if rec > 0
                      'new code added here for selection
                      	if rec < 0  then
                      		'play_sound("g:\BCBSS\UH_OH.wav")
                      		UI_MSG_BOX(agency+" - FIND","Customer Entered -  "+chr_multi(13,2)+ut(fname)+" "+ut(lname)+",  DOB - "+DTOC(DOB)+chr_multi(13,2)+"Does NOT exist in our System,"+chr_multi(13,2)+"Please check the spelling and Date of Birth,"+chr_multi(13,2)+"IF it correct,"+chr_multi(13,2)+space(10)+"They may be a NEW Customer.",16)
                      		goto retry1
                      	  else
                      		tblkey = trim(tblc.lname)+" "+trim(tblc.fname)
                      		wordct= W_COUNT(tblkey)		
                      		while tblkey = fname1
                      			Names[i]=ut(tblc.fname)+" "+ut(tblc.lname)+" -  SSN: "+left(tblc.ssn,3)+"-"+substr(tblc.ssn,4,2)+"-"+trim(substr(tblc.ssn,6,7))+" - Addr: "+trim(tblc.addr1)+" - Born on: "+dtoc(tblc.dob)
                      			tblc.fetch_next()
                      			i = i+1
                      			tblkey = trim(tblc.lname)+" "+trim(tblc.fname)
                      		end while
                      		'added by hubert
                      		'************************************* 
                      		tblc.close()
                      		'**************************************	
                      		if i = 2
                      			SSNN = alltrim(remspecial(word(names(1),wordct+3)))
                      			'goto checksoc
                      			soc1=padr(trim(ssnn),13," ")	
                      			INDX_1 = tbl.index_primary_put("ssn")
                      			rec= tbl.fetch_find(soc1)
                      			if rec > 0
                      				tbl.index_primary_put("Fullname")
                      				parentform.resynch()
                      				end
                      			end if
                      		end if
                      		names.resize(i-1)
                      		names.sort("A","dtos(ctod(word(value,-1)))")
                      				
                      		dim name1 as C
                      		name1 = ""
                      		name1 = "We found "+ alltrim(str(i-1,4,0))+" "+replace_parameters(" matches for the name [varC->FNAME2]!  THIS LIST IS IN BIRTH DATE ORDER.",local_variables())
                      		name3 = "Please check this list carefully before entering a New Cusomer!"
                      		tryagain1:
                      		DIM SHARED WHO as C
                      		DIM SHARED varC_result as C
                      		ok_button_label = "&YES"
                      		cancel_button_label = "&NO"
                      		varC_result = ui_dlg_box(Agency + " Customer Information",<<%dlg%
                      		{region}
                      		{text=130:name1};
                      		{text=130:name3};
                      		{line=1,0};
                      		{endregion};
                      		{region}
                      		Please Select: |[.100,8WHO^#names];
                      		{endregion};
                      		{line=1,0};
                      		{region}
                      		<*15=ok_button_label!OK> <15=cancel_button_label!NO>
                      		{endregion};
                      		%dlg%)
                      		if varC_result="NO"
                      			ui_msg_box(agency+" Customer Search","Action Cancelled at user request")
                      			end
                      		end if
                      		if who = ""
                      			'no client selected, retry
                      			ui_msg_box(agency+" Customer Select","No Selection was made, Please Select a Name")
                      			goto tryagain1
                      		end if
                      		ssnn = padr(alltrim(remspecial(word(who,wordct+3))),13," ")
                      		soc1=padr(trim(ssnn),13," ")	
                      		INDX_1 = tbl.index_primary_put("ssn")
                      		rec= tbl.fetch_find(soc1)
                      		if rec > 0
                      			tbl.index_primary_put("Fullname")
                      			parentform.resynch()
                      			end
                      		end if
                      	end if
                      	end
                      end if
                      if search_by="Last Name" then
                      	lname2=padr(trim(lname)+" A",25," ")
                      	indx_3 = tbl.index_primary_put("Fullname")
                      	'fetch_first(db_current())
                      	rec = tbl.fetch_find(lname2)
                      	if tbl.lname <> lname  then
                      		'play_sound("g:\BCBSS\UH_OH.wav")
                      		UI_MSG_BOX(agency+" - FIND","Customer Name -  "+chr(13)+chr(13)+ut(lname)+chr(13)+chr(13)+"Does NOT exist in our System,"+chr(13)+chr(13)+"Please check the spelling,"+chr(13)+space(10)+"OR"+chr(13)+"They may be a NEW Customer.",16)
                      		goto retry1
                      	  else
                      		parentform.resynch()						
                      		UI_MSG_BOX(agency+" - FIND","This is the FIRST customer with a Last name of"+chr(13)+chr(13)+ut(lname)+chr(13)+chr(13)+"If this is not who you need, hit "+chr(39)+"Page Down"+chr(39)+" until you retrieve your Customer",64)
                      	end if
                      	end
                      end if
                      if search_by="Last Name 1st Initial" then
                      reenter:
                      	lfname1=ut(lname)+", "+ut(int)
                      	dim names[400] as C
                      	names.clear()
                      	i = 1
                      	dim tblc as P
                      	tblc = table.open("client",FILE_RO_SHARED)
                      	indx_2 = tblc.index_primary_put("LastFirst")
                      	'fetch_first(db_current())
                      	rec = tblc.fetch_find(LFNAME1)
                      	'new code added here for selection
                      	if rec < 0  
                      		if LNAME2 <>""
                      			if ut(lname2) <> ut(lname)
                      				UI_MSG_BOX(agency+" - FIND","Customer Entered -  "+chr_multi(13,2)+ut(int)+" "+ut(lname)+",  DOB - "+DTOC(DOB)+chr_multi(13,2)+"Does NOT exist in our System,"+chr_multi(13,2)+"Checking by \"Other Name\", "+LNAME2,16)
                      				LNAMEOLD = LNAME
                      				LNAME = LNAME2
                      				GOTO REENTER
                      			  else
                      			  	UI_MSG_BOX(agency+" - FIND","Customer Entered -  "+chr_multi(13,2)+ut(int)+" "+ut(lname)+",  DOB - "+DTOC(DOB)+chr_multi(13,2)+"Does NOT exist in our System,"+chr_multi(13,2)+"Please check the spelling and Date of Birth,"+chr_multi(13,2)+"IF it is correct,"+chr_multi(13,2)+space(10)+"They may be a NEW Customer.",16)
                      				goto retry1
                      			end if
                      		  ELSE
                      		'play_sound("g:\BCBSS\UH_OH.wav")
                      			UI_MSG_BOX(agency+" - FIND","Customer Entered -  "+chr_multi(13,2)+ut(int)+" "+ut(lname)+",  DOB - "+DTOC(DOB)+chr_multi(13,2)+"Does NOT exist in our System,"+chr_multi(13,2)+"Please check the spelling and Date of Birth,"+chr_multi(13,2)+"IF it is correct,"+chr_multi(13,2)+space(10)+"They may be a NEW Customer.",16)
                      			goto retry1
                      		end if
                      	  else
                      		tblkey = trim(tblc.lname)+", "+ut(left(tblc.fname,1))
                      		while tblkey = lfname1
                      			if dob <>{} 
                      				if tblc.Dob = dob
                      			  		Names[i]=ut(tblc.fname)+" "+ut(tblc.lname)+" -  SSN: "+left(tblc.ssn,3)+"-"+substr(tblc.ssn,4,2)+"-"+trim(substr(tblc.ssn,6,7))+" - Addr: "+trim(tblc.addr1)+" - Born on: "+dtoc(tblc.dob)
                      					i = i+1
                      				end if
                      			  else
                      			  		Names[i]=ut(tblc.fname)+" "+ut(tblc.lname)+" -  SSN: "+left(tblc.ssn,3)+"-"+substr(tblc.ssn,4,2)+"-"+trim(substr(tblc.ssn,6,7))+" - Addr: "+trim(tblc.addr1)+" - Born on: "+dtoc(tblc.dob)
                      					i = i+1
                      			end if
                      				tblkey = trim(tblc.lname)+", "+ut(left(tblc.fname,1))
                      				tblc.fetch_next()	
                      		end while
                      		'added by hubert
                      		'************************************* 
                      		tblc.close()
                      		'**************************************	
                      		if i = 2
                      			if word(names(1),5)="SSN"
                      				SSNN = alltrim(remspecial(word(names(1),6)))
                      			  else
                      			  	SSNN = alltrim(remspecial(word(names(1),5)))
                      			end if
                      
                      			'goto checksoc
                      			soc1=padr(trim(ssnn),13," ")	
                      			INDX_1 = tbl.index_primary_put("ssn")
                      			rec= tbl.fetch_find(soc1)
                      			if rec > 0
                      				tbl.index_primary_put("Fullname")
                      				parentform.resynch()
                      				end
                      			end if
                      		end if
                      		names.resize(i-2)
                      		names.sort("A","word(value,1)+dtos(ctod(word(value,-1)))")
                      				
                      		dim name1 as C
                      		name1 = ""
                      		name1 = "We found "+ alltrim(str(i-2,4,0))+" "+replace_parameters(" matches for the name [varC->LFNAME1]!  THIS LIST IS IN FIRST NAME ORDER.",local_variables())
                      		name3 = "Please check this list carefully before entering a New Cusomer!"
                      		tryagain5:
                      		DIM SHARED WHO as C
                      		DIM SHARED varC_result as C
                      		ok_button_label = "&YES"
                      		cancel_button_label = "&NO"
                      		varC_result = ui_dlg_box(Agency + " Customer Information",<<%dlg%
                      		{region}
                      		{text=130:name1};
                      		{text=130:name3};
                      		{line=1,0};
                      		{endregion};
                      		{region}
                      		Please Select: |[.110,15WHO^#names];
                      		{endregion};
                      		{line=1,0};
                      		{region}
                      		<*15=ok_button_label!OK> <15=cancel_button_label!NO>
                      		{endregion};
                      		%dlg%)
                      		if varC_result="NO"
                      			ui_msg_box(agency+" Customer Search","Action Cancelled at user request")
                      			end
                      		end if
                      		if who = ""
                      			'no client selected, retry
                      			ui_msg_box(agency+" Customer Select","No Selection was made, Please Select a Name")
                      			goto tryagain5
                      		end if
                      		if word(who,5)="SSN"
                      			SSNN = padr(alltrim(remspecial(word(who,6))),13," ")
                      		  else
                      		  	SSNN = padr(alltrim(remspecial(word(who,5))),13," ")
                      		end if
                      		'ssnn = padr(alltrim(remspecial(word(who,5))),13," ")
                      		soc1=padr(trim(ssnn),13," ")	
                      		INDX_1 = tbl.index_primary_put("ssn")
                      		rec= tbl.fetch_find(soc1)
                      		if rec > 0
                      			tbl.index_primary_put("Fullname")
                      			parentform.resynch()
                      			end
                      		end if
                      	end if
                      	end
                      end if
                      '******************  NEW 01/16/2008  ****************************
                      if search_by="Last, First, DOB" then
                      	FNAME = FNAME1
                      	'debug(1)
                      	DIM NAMES(20) as C
                      	names.clear()
                      	i = 1
                      	dim tblc as P
                      	tblc = table.open("client",FILE_RO_SHARED)
                      	lname2=padr(trim(lname),25," ")+padr(trim(fname),20," ")+dtos(dob)
                      	indx_3 = tblc.index_primary_put("LFDOB")
                      	'fetch_first(db_current())
                      	rec = tblc.fetch_find(lname2)
                      	if rec < 0  then
                      		UI_MSG_BOX(agency+" - FIND","Customer Entered -  "+chr_multi(13,2)+ut(fname)+" "+ut(lname)+",  DOB - "+DTOC(DOB)+chr_multi(13,2)+"Does NOT exist in our System,"+chr_multi(13,2)+"Please check the spelling and Date of Birth,"+chr_multi(13,2)+"IF it correct,"+chr_multi(13,2)+space(10)+"They may be a NEW Customer.",16)
                      		goto retry1
                      	  else
                      		tblkey = tblc.lname+tblc.fname+dtos(tblc.dob)		
                      		while tblkey = lname2
                      			Names[i]=ut(tblc.fname)+" "+ut(tblc.lname)+" -  SSN: "+left(tblc.ssn,3)+"-"+substr(tblc.ssn,4,2)+"-"+trim(substr(tblc.ssn,6,7))+" - Addr: "+trim(tblc.addr1)+" - Born on: "+dtoc(tblc.dob)
                      			tblc.fetch_next()
                      			i = i+1
                      			tblkey = tblc.lname+tblc.fname+dtos(tblc.dob)				   
                      		end while
                      		'added by hubert
                      		'************************************* 
                      		tblc.close()
                      		'**************************************	
                      		if i = 2
                      			if word(names(1),5)="SSN"
                      				SSNN = alltrim(remspecial(word(names(1),6)))
                      			  else
                      			  	SSNN = alltrim(remspecial(word(names(1),5)))
                      			end if
                      			'SSNN = alltrim(remspecial(word(names(1),5)))
                      			goto checksoc
                      		end if
                      		names.resize(i-1)		
                      		dim name1 as C
                      		name1 = ""
                      		dim namex as C
                      		namex = word(names[1],1)+" "+word(names[1],2)
                      		name1 = replace_parameters("Is One of these the Correct Customer record for [varC->namex]?",local_variables())
                      		tryagain2:
                      		DIM SHARED WHO as C
                      		DIM SHARED varC_result as C
                      		ok_button_label = "&YES"
                      		cancel_button_label = "&NO"
                      		varC_result = ui_dlg_box(Agency + " Customer Information",<<%dlg%
                      		{region}
                      		{text=70:name1};
                      		{line=1,0};
                      		{endregion};
                      		{region}
                      		Please Select: |[.100,5WHO^#names];
                      		{endregion};
                      		{line=1,0};
                      		{region}
                      		<*15=ok_button_label!OK> <15=cancel_button_label!NO>
                      		{endregion};
                      		%dlg%)
                      		if varC_result="NO"
                      			ui_msg_box(agency+" Customer Search","Action Cancelled at user request")
                      			end
                      		end if
                      		if who = ""
                      			'no client selected, retry
                      			ui_msg_box(agency+" Customer Select","No Selection was made, Please Select a Name")
                      			goto tryagain2
                      		end if
                      		if word(who,5)="SSN"
                      				SSNN = padr(alltrim(remspecial(word(who,6))),13," ")
                      			  else
                      			  	SSNN = padr(alltrim(remspecial(word(who,5))),13," ")
                      		end if
                      		'ssnn = padr(alltrim(remspecial(word(who,5))),13," ")
                      		goto checksoc
                      	end if
                      end if
                      '******************************************************************************						
                      if search_by="Investigations" then
                      	addr=STATE+padr(trim(LEFT(CITY,5)),5," ")+LEFT(WORD(ADDR,2),7)+WORD(ADDR,1)
                      	debugcheck()
                      	tbl.index_primary_put("ADDRESS")
                      	'fetch_first(db_current())
                      	rec = tbl.fetch_find(addr)
                      	if rec >0  then
                      		parentform.resynch()
                      		ui_msg_box(agency+" - FIND","A Customer with this Address Exists! Please check that this is the Customer you requested.",16)
                      	  ELSE
                      		UI_MSG_BOX(agency+" - FIND","Customer Address Does NOT exist in System, may be a NEW Customer.",16)
                             	goto retry1
                      	end if
                      	
                      end if
                      end
                      Tom

                      Comment


                        #12
                        Re: Create a search

                        Hi all,

                        Thanks for the replies. I will have a look through and see what I can find.

                        :)
                        Wise Alpha once said said to me...
                        ..."Change must begin first."

                        Comment


                          #13
                          Re: Create a search

                          my mistake.

                          examples of the dialog box search are in this thread...

                          http://msgboard.alphasoftware.com/al...ad.php?t=90048

                          Tom

                          Comment

                          Working...
                          X