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

Help with Progressive Find dialog

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

    #16
    Re: Help with Progressive Find dialog

    After some more studying - PTL I figured it out. The Search_name (Progressive Find) now will populate the search variable with the information in the first row.

    User can type in search criteria and when the first row satisfies the criteria, user can hit the enter button and the correct record is displayed.

    User can switch on the fly if they want to change search criteria.



    Code:
    'Date Created: 04-Dec-2007 12:28:46 AM
    'Last Updated: 14-May-2009 01:55:12 PM
    'Created By  : David
    'Updated By  : David
    
    'Inline-Xbasic. Converted from: Create an XDialog dialog box to prompt for parameters.
    'Create an XDialog dialog box to prompt for parameters.
    
    OPTION break
    
    DIM SHARED vLastname as C
    
    DIM SHARED vName as C
    DIM SHARED vFirstname as C
    DIM SHARED vSpouse as C
    DIM SHARED vSSN as C
    DIM SHARED vClientid as C
    DIM SHARED vAddress as C
    DIM SHARED vCity as C
    DIM SHARED vState as C
    DIM SHARED vZipCode as C
    DIM SHARED vHomephone as C
    DIM SHARED vWorkphone as C
    DIM SHARED vCellphone as C
    DIM SHARED vFaxphone as C
    DIM SHARED vE_Mail as C
    DIM SHARED vE_Mail1 as C
    DIM SHARED vEmployer as C
    
    DIM SHARED vProspects as L
    DIM SHARED vReferrals as L
    
    DIM SHARED varC_result as C
    
    vProspects = .f.
    vReferrals = .f.
    vName = ""
    
    DIM vName_FuncCode as C = <<%CodeFunctions%
    
    FUNCTION DoSort AS V (byref CurrentSortField AS C , byref CurrentSortDirection AS C, NewSortField AS C,  Filter AS C, pLV AS P, rs AS P )
    	DIM cResult AS C
    	DIM SortDirection AS C
    	DIM SortField AS C
    
    	IF NewSortField = CurrentSortField
    		' clicked on same field, reverse sort
    		IF CurrentSortDirection = "D"
    			CurrentSortDirection = "A"
    		ELSE
    			CurrentSortDirection = "D"
    		END IF
    	ELSE
    		CurrentSortField = NewSortField
    		CurrentSortDirection = "A"
    	END IF
    
    	SortDirection	= CurrentSortDirection
    	SortField		= CurrentSortField
    	IF SortDirection = "D"
    		SortField = "invert(" + SortField + ")"
    	END IF
    	
    	' actual sorting code goes here
    	pLV.RowView.Close()
    	pLV.RowView = rs.OpenView(1, SortField, Filter)
    	
    	DoSort = cResult
    END FUNCTION
    
    FUNCTION GetArguments AS C ( pTableDef AS P, lv AS P )
    	DIM cResult AS C
    	DIM pv AS P
    
    	FOR EACH x IN pTableDef.pArgs.arrArgs
    		IF (":"+x.Name) $ pTableDef.Filter
    			pv = A5_ArgGetValue(x, lv)
    			x.value = pv.value
    		END IF
    	NEXT
    
    	cResult = a5_ArgumentsReplace(pTableDef.filter, pTableDef.pArgs.arrArgs)
    
    	GetArguments = cResult
    END FUNCTION
    
    %CodeFunctions%
    DIM vName_Funcs as P = compile_template(vName_FuncCode)
    
    DIM SHARED vName as C
    DIM vName_CurrentSortField as C = "lastname"
    DIM vName_CurrentSortDirection as C = "A"
    
    DIM vName_Filter as C
    DIM vName_pTableDef as P
    DIM vName_pTableDef.ReturnValueExpression as C = "Client_id"
    DIM vName_pTableDef.FieldList as C = <<%txt%
    Client_id
    Lastname
    Firstname
    Suffix
    Soc_sec_no
    Spouse
    Sp_ss_no
    trim(Address1) + "  " + trim(Address2)
    City
    State
    Zip_code
    %txt%
    DIM vName_pTableDef.TitleRow as C = "{WIDTH=0.5}Id|{WIDTH=1.5}Lastname|{WIDTH=1.2}Firstname|{WIDTH=.3}S|{WIDTH=1}Soc_sec_no|{WIDTH=1.2}Spouse|{WIDTH=1}Sp_ss_no|{WIDTH=1.5}Address|{WIDTH=1.2}City|{WIDTH=0.4}St|{WIDTH=.7}Zip_code"
    DIM vName_pTableDef.Arguments as C = <<%txt%
    <lastbutton="ok">
    <arrArgs<[1]<Name="argLastname">
    <DataType="Character">
    <Source="Variable">
    <SourceType="Local Variable">
    <DefaultValue="">
    <Prompt=.F.>
    <PromptText="">
    <PromptControlType="Text Box">
    <PromptChoices="">
    <PromptDlgTitle="Missing Argument">
    <PromptTextAbove="">
    <SourceDisplay="Get value from variable">
    <VariableScope="Session Variable">
    <VariableName="vLastname">
    <VariableWithScope="vLastname (Session Variable)">
    <PreviewValue="">
    %txt%
    DIM vName_pTableDef.pArgs as P
    property_from_string(vName_pTableDef.pArgs, vName_pTableDef.Arguments)
    DIM vName_pTableDef.TableName as C = "all_clients"
    DIM vName_pTableDef.Filter as C = "left(trim(lastname) + \" \" + trim(Firstname) + \" \" + trim(Suffix), len(:argLastname)) = :argLastname .AND. (recno() > 0)"	' recno() > 0 is required in order to avoid showing deleted variables
    DIM vName_pTableDef.Order as C = "Lastname+Firstname+Suffix"
    DIM vName_pTableDef.pAdvFormatting as P
    DIM vName_pTableDef.pAdvFormatting.alternating_bands as L = .t.
    DIM vName_pTableDef.pAdvFormatting.group_size as N = 2
    DIM vName_pTableDef.pAdvFormatting.odd_row_color as C = "White"
    DIM vName_pTableDef.pAdvFormatting.even_row_color as C = "#214+214+255"
    DIM vName_pTableDef.pAdvFormatting.odd_selected_color as C = "Dark Blue"
    DIM vName_pTableDef.pAdvFormatting.even_selected_color as C = "Dark Blue"
    DIM vName_pTableDef.pAdvFormatting.font as C = "Arial,8"
    DIM vName_pTableDef.pAdvFormatting.font_color_unselected as C = "Dark Blue"
    DIM vName_pTableDef.pAdvFormatting.font_color_selected as C = "White"
    DIM vName_pTableDef.pAdvFormatting.number_rows as L = .f.
    DIM vName_pTableDef.pAdvFormatting.tab_stops as C = ""
    
    
    vName_pLV.titlerow = vName_pTableDef.titlerow
    vName_pLV.titleevents = "vName_Sort_Client_id|vName_Sort_Lastname|vName_Sort_Suffix|vName_Sort_Firstname|vName_Sort_Soc_sec_no|vName_Sort_Spouse|vName_Sort_Sp_ss_no|vName_Sort_Address1|vName_Sort_City|vName_Sort_State|vName_Sort_Zip_code"
    vName_pLV.style = "report,singlesel,gridlines,fullrowselect"
    vName_pLV.dragbehaviour = ""
    vName_pLV.dropbehaviour = ""
    DIM vName_t as P
    DIM vName_rr as Alpha5::RowRelation
    DIM vName_rs as P
    
    IF .NOT. file.exists(table.filename_get(vName_pTableDef.TableName))
    	END'
    END IF
    
    vName_t = table.open(vName_pTableDef.TableName, FILE_RO_SHARED)
    vName_t.persist()
    vName_rs = vName_rr.TableToRowSource(vName_t)
    
    vName_Filter = vName_Funcs.GetArguments(vName_pTableDef, local_variables())
    vName_pLV.rowview = vName_rs.OpenView(1, vName_pTableDef.Order, vName_Filter)
    vName_pLV.RowSeparator = crlf()
    vName_pLV.ColumnSeparator = "|"
    vName_pLV.Key = vName_pTableDef.ReturnValueExpression
    vName_pLV.Columns = a5_owner_draw_list_fmt(vName_pTableDef.FieldList, vName_pTableDef.pAdvFormatting, "listviewvirtual")
    vName_pLV.events = <<%code%
    FUNCTION OnRightClick as C(lv as P, listView as P, args as P)
    	WITH lv
    		listView.Selection = listView.GetRowValue(args.GetClickRow())
    		OnSelectionChanged(lv, listView)
    	END WITH
    END FUNCTION	
    
    FUNCTION OnDoubleClick as C(lv as P, listView as P, args as P)
    	WITH lv
    		vName = listView.GetRowValue(args.GetClickRow())
    
    	END WITH
    END FUNCTION	
    
    FUNCTION OnSelectionChanged AS V (lv as P, listView as P)
    	WITH lv
    		vName = listView.Selection
    
    	END WITH
    END FUNCTION
    
    FUNCTION OnKeyDown as v(vars as P, listView as P, args as P)
    	DIM key as C
    	DIM KeyName as C
    
    	key = args.GetKeyName()
    	KeyName = key
    
    	IF key = "{Delete}" .OR. key = "{Num Del}"
    		KeyName = "{Delete}"
    	  ELSE IF args.keycode = 13 ' enter
    		KeyName = "{Enter}"
    	  ELSE IF args.keycode = 8 ' backspace
    		KeyName = "{Backspace}"
    	END IF
    
    END FUNCTION
    %code%
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    
    varC_result = ui_dlg_box("Search by Last Name", <<%dlg%
    {background=Blue White}{font= tahoma, 10}
    {region}
    | [.40vLastname];
    | {listviewvirtual=205,25vName^=vName_pLV};
    {watch=vLastname!vName_refresh}
    {watch=vName!foo};
    {endregion};
    {line=1,0};
    {region}
    <%B=M%15Last Name!last> |<%B=M%15First Name!first> |<%B=M%15Client SSN!c_ssn> | <%B=M%15Address!address> |<%B=M%15State!state> |<%B=M%15Home Phone!hphone> | <%B=M%15Cell Phone!cphone> | <%B=M%15EMail!email> |<%B=M%15Employer!employer>;
    <%B=M%15Client Id!c_id> |<%B=M%15Spouse!spouse> |<%B=M%15Spouse SSN!s_ssn> | <%B=M%15City!city> |<%B=M%15Zip Code!zip> |<%B=M%15Work Phone!wphone> | <%B=M%15Fax Phone!fphone> | <%B=M%15EMail_1!email1>;
     {endregion};
    {line=1,0};
    {region}
    
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    '<*15=ok_button_label!OK?vName<\>""> <15=cancel_button_label!CANCEL>
    
    IF left(a_dlg_button, len("vName_Sort_")) = "vName_Sort_"
    	DIM NewSortField as C
    	NewSortField = substr(a_dlg_button, len("vName_Sort_") + 1)
    	vName_Funcs.DoSort(vName_CurrentSortField, vName_CurrentSortDirection, NewSortField, vName_Filter, vName_pLV, vName_rs)
    	a_dlg_button = ""
    
    END IF
    
    IF a_Dlg_button = "vName_refresh"
    	a_dlg_button = ""
    
    	vName_Filter = vName_Funcs.GetArguments(vName_pTableDef, local_variables())
    	vName_pLV.RowView.Close()
    	vName_pLV.RowView = vName_rs.OpenView(1, vName_CurrentSortField, vName_Filter)
    
    END IF
    
    IF a_dlg_button = "foo"
    	debug(1)
    	a_dlg_button = ""
    	' do nothing
    END IF
    
    'This populates search variable vName with search criteria found in first row
    '===================
    vname_t.index_primary_put("name")
    vName_t.fetch_find(vLastname)
    dim vName_ck as c
    
    vName_ck = vname_t.client_id
    vName_t.index_primary_put("client_id")
    '===================
    
    %code%)
    
    vName_t.close()
    
    IF vname = "" .and. varC_result = "OK"
    	vName = vName_ck
    END IF	
    
    IF varC_result = "Cancel"
    	END'
    END IF	
    
    script_play("Search_Finish")
    
    END'
    Code:
    'Date Created: 04-Dec-2007 12:28:46 AM
    'Last Updated: 13-May-2009 10:44:07 AM
    'Created By  : David
    'Updated By  : David
    
    DIM SHARED vLastname as C
    
    DIM SHARED vFirstname as C
    DIM SHARED vSpouse as C
    DIM SHARED vSSN as C
    DIM SHARED vClientid as C
    DIM SHARED vAddress as C
    DIM SHARED vCity as C
    DIM SHARED vState as C
    DIM SHARED vZipCode as C
    DIM SHARED vHomephone as C
    DIM SHARED vWorkphone as C
    DIM SHARED vCellphone as C
    DIM SHARED vFaxphone as C
    DIM SHARED vE_Mail as C
    DIM SHARED vE_Mail1 as C
    
    DIM SHARED vProspects as L
    DIM SHARED vReferrals as L
    
    DIM SHARED varC_result as C
    
    DIM SHARED vName as C
    
    vProspects = .f.
    vReferrals = .f.
    
    SELECT
    	CASE varC_result = "cancel"
    		END'
    	CASE varC_result = "last"
    		vLastname = vFirstname
    		IF vFirstname > ""
    			vLastname = vFirstname
    		  ELSE
    			vLastname = vSpouse
    		END IF
    		script_play("Search_Name")
    	CASE varC_result = "first"
    		IF vLastname > ""
    			vFirstname = vLastname
    		  ELSE
    			vFirstname = vSpouse
    		END IF
    		vFirstname = vLastname
    		script_play("Search_FirstName")
    	CASE varC_result = "spouse"
    		IF vLastname > ""
    			vSpouse = vLastname
    		  ELSE
    			vSpouse = vFirstname
    		END IF
    		script_play("Search_Spouse")
    	CASE varC_result = "c_ssn"
    		script_play("Search_SSN")
    	CASE varC_result = "s_ssn"
    		script_play("Search_SpouseSSN")
    	CASE varC_result = "c_id"
    		script_play("Search_ClientId")
    	CASE varC_result = "address"
    		script_play("Search_Address")
    	CASE varC_result = "city"
    		script_play("Search_City")
    	CASE varC_result = "state"
    		script_play("Search_State")
    	CASE varC_result = "zip"
    		script_play("Search_ZipCode")
    	CASE varC_result = "hphone"
    		vWorkphone = vHomephone
    		vCellphone = vHomephone
    		vFaxphone = vHomephone
    		script_play("Search_HomePhone")
    	CASE varC_result = "wphone"
    		vHomephone = vWorkphone
    		vCellphone = vWorkphone
    		vFaxphone = vWorkphone
    		script_play("Search_WorkPhone")
    	CASE varC_result = "cphone"
    		vHomephone = vCellphone
    		vWorkphone = vCellphone
    		vFaxphone = vCellphone
    		script_play("Search_CellPhone")
    	CASE varC_result = "fphone"
    		vHomephone = vFaxphone
    		vWorkphone = vFaxphone
    		vCellphone = vFaxphone
    		script_play("Search_FaxPhone")
    	CASE varC_result = "email"
    		vE_Mail = vE_Mail1
    		script_play("Search_EMail")
    	CASE varC_result = "email1"
    		vE_Mail1 = vE_Mail
    		script_play("Search_EMail1")
    	CASE varC_result = "employer"
    		script_play("Search_Employer")
    END SELECT
    
    ON ERROR goto restart
    
    IF left(vName, 2) = "CL"
    	IF is_object(":MDC Prospect System") .and. is_object(":MDC Credit System")
    		MDC_Prospect_System.close()
    
    		MDC_Credit_System.Index_Set("client_id")
    		MDC_Credit_System.find(vName)
    		topparent.resynch()
    		MDC_Credit_System.Query_Clear()
    		MDC_Credit_System.Index_Set("name")
    
    	  ELSE IF is_object(":MDC Referral System") .and. is_object(":MDC Credit System")
    		MDC_Referral_System.close()
    
    		MDC_Credit_System.Index_Set("client_id")
    		MDC_Credit_System.find(vName)
    		topparent.resynch()
    		MDC_Credit_System.Query_Clear()
    		MDC_Credit_System.Index_Set("name")
    
    	  ELSE
    		DIM f as P
    		f = obj(":MDC Credit System")
    		IF .not. is_object(f) THEN
    			filter = "client_id= '" + vName + "'"
    			f = :form.ViewQueried("MDC Credit System", filter)
    			f.show()
    			f.activate()
    			IF is_object(":MDC Referral System")
    				MDC_Referral_System.close()
    			END IF	
    			IF is_object(":MDC Prospect System")
    				MDC_Prospect_System.close()
    			END IF	
    		  ELSE
    			DIM t as P
    
    			t = table.get("client")
    			t.index_primary_put("client_id")
    			t.fetch_find(vName)
    			t.index_primary_put("name")
    
    			topparent.resynch()
    
    		END IF
    	END IF
      ELSE IF left(vName, 2) = "VN"
    	vReferrals = .t.
    	IF is_object(":MDC Prospect System")
    		MDC_Prospect_System.close()
    	END IF	
    
    	IF Systemname <> "MDC Referral System"
    		DIM f as P
    
    		filter = "vendor_id= '" + vName + "'"
    		f = :form.ViewQueried("MDC Referral System", filter)
    		f.show()
    		f.activate()
    	  ELSE
    		MDC_Referral_System.Index_Set("vendor_id")
    		MDC_Referral_System.find(vName)
    		xbasic_wait_for_idle()
    		topparent.resynch()
    	END IF
    
      ELSE
    	vProspects = .t.
    	IF is_object(":MDC Referral System")
    		MDC_Referral_System.close()
    	END IF	
    
    	IF Systemname <> "MDC Prospect System"
    		DIM f as P
    
    		filter = "client_id= '" + vName + "'"
    		f = :form.ViewQueried("MDC Prospect System", filter)
    		f.show()
    		f.activate()
    	  ELSE
    		DIM t as P
    
    		MDC_Prospect_System.Index_Set("client_id")
    		MDC_Prospect_System.find(vName)
    		topparent.resynch()
    	END IF
    END IF
    
    '---------------
    restart:
    '---------------
    END'
    David Montgomery

    Comment


      #17
      Re: Help with Progressive Find dialog

      This code with the example table named either clients or client does nothing in my hands. No action what so ever.
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


        #18
        Re: Help with Progressive Find dialog

        Sorry the previous attachment had some incorrectly named tables.

        This attachment should provide a working example. Double click on the Progressie_Find script on the code tab.
        Last edited by David Montgomery; 05-15-2009, 11:27 AM.
        David Montgomery

        Comment


          #19
          Re: Help with Progressive Find dialog

          1
          David Montgomery

          Comment


            #20
            Re: Help with Progressive Find dialog

            Why the additional post? Thought you had a solution, see message 16 in this thread.

            Comment

            Working...
            X