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



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

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with Progressive Find dialog

    I have studied the progressive find in Alphasports and in the Learning Xdialog samples but can't figure out how to make the first row populate my search variable (vName). If I don't click on the first row it doesn't populate the variable. Can someone help me with this?
    'Date Created: 04-Dec-2007 12:28:46 AM
    'Last Updated: 12-May-2009 12:22:07 AM
    '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 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"
    			CurrentSortDirection = "D"
    		END IF
    		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 = rs.OpenView(1, SortField, Filter)
    	DoSort = cResult
    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
    	cResult = a5_ArgumentsReplace(pTableDef.filter, pTableDef.pArgs.arrArgs)
    	GetArguments = cResult
    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%
    trim(Address1) + "  " + trim(Address2)
    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%
    <SourceType="Local Variable">
    <PromptControlType="Text Box">
    <PromptDlgTitle="Missing Argument">
    <SourceDisplay="Get value from variable">
    <VariableScope="Session Variable">
    <VariableWithScope="vLastname (Session Variable)">
    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" = "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 IF
    vName_t =, FILE_RO_SHARED)
    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") = <<%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)
    FUNCTION OnDoubleClick as C(lv as P, listView as P, args as P)
    	WITH lv
    		vName = listView.GetRowValue(args.GetClickRow())
    FUNCTION OnSelectionChanged AS V (lv as P, listView as P)
    	WITH lv
    		vName = listView.Selection
    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
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Search by Last Name", <<%dlg%
    {background=Blue White}{font= tahoma, 10}
    | [.40vLastname];
    | {listviewvirtual=205,25vName^=vName_pLV};
    <%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>;
    <*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 = vName_rs.OpenView(1, vName_CurrentSortField, vName_Filter)
    END IF
    IF a_dlg_button = "foo"
    	a_dlg_button = ""
    	' do nothing
    END IF
    IF vname = "" .and. varC_result = "OK"
    	GOTO restart
    END IF	
    IF varC_result = "Cancel"
    END IF	
    David Montgomery

  • #2
    Re: Help with Progressive Find dialog

    I copied your code and made a new script from it. Ran the script, got an error due to not having the UDF that you call in Line 9. Upload enough of the code and the database data so that we can reproduce the error message that you are getting.


    • #3
      Re: Help with Progressive Find dialog

      Andrew thank you for the reply.

      Count_Records() can be omitted - it just counts the records in the table.

      I am not getting any errors. The code works great. I just see in Alphasports that the first row in the Progressive Find populates the search variable without having to click on the row.

      Once I click on the first row or any row my search variable (vName) is populated and the correct record is found. However, I think it is possible to have the first row 'automaticaly' populate the search variable so that if the user types in enough search info to make the first row satisfy the search criteria - then just click the ok button - NOT click the first row and then click the OK button.

      I have the OK button disabled until the search row is clicked to keep from getting error messages.
      David Montgomery


      • #4
        Re: Help with Progressive Find dialog

        I commented out the UDF call on Line 9, ran the script nothing happened. No error messages and a xdialog window was NOT displayed. Is there something that I am missing?


        • #5
          Re: Help with Progressive Find dialog

          See attached file. Sorry after checking this I find I named the table wrong. The 'clients' table should be named client (without the 's')
          David Montgomery


          • #6
            Re: Help with Progressive Find dialog

            David -

            I think this is what you want. In the form properties ONINIT the following code sets the vcSearchby variable.

            dim shared vcSearchby as c 
            vcSearchby = "Lastname"
            dim tbl as p 
            tbl = table.current()



            • #7
              Re: Help with Progressive Find dialog

              Thanks Scott, I will give it a try
              David Montgomery


              • #8
                Re: Help with Progressive Find dialog

                Thanks Scott,

                This script is designed to search by lastname, I have other scripts that search with other criteria.

                The script_play("Search_Finish) at the end of script does what you describe.

                Everything in my scripts is working without error. I am just trying to figure out a way to skip the step of having to click on the first row (assuming it satisfies the search criteria) to populate var->vName.

                I would like the script to populate the search variable vName automatically with the first row - assuming no other row is clicked
                David Montgomery


                • #9
                  Re: Help with Progressive Find dialog

                  David -

                  Some where along the line you have to initalize search criteria to lastname. If you want it to start out that way. That initailization (in AlphaSports) happens in the ONINIT event in the form properties.

                  Some how - even if it is in this code you have to give it an initial value. Unless I'm reading this wrong - which is entirely possible your search criteria is starting out as " ".

                  I have to be out of the office for the rest of the afternoon - I'll look more closely when I return.



                  • #10
                    Re: Help with Progressive Find dialog

                    David -

                    Sorry to say - this is beyond me. I'm just not seeing it either. Hopefully some one else can step in.

                    I'll be watching with interest.



                    • #11
                      Re: Help with Progressive Find dialog

                      Would anything from this thread help?

                      Mike W
                      "I rebel in at least small things to express to the world that I have not completely surrendered"


                      • #12
                        Re: Help with Progressive Find dialog

                        Originally posted by Mike Wilson View Post
                        Would anything from this thread help?

                        Thanks Mike, but I couldn't find anything there that answered my question.
                        David Montgomery


                        • #13
                          Re: Help with Progressive Find dialog

                          David, are you talking about the "Progressive Lookup" that appears when the "Find Customer" button is pushed on the Customer Information form? Something else? The Progressive Lookup doesn't populate any search variable so far as I can tell.

                          Suggest you post a working model of your database with instructions for us to follow to find and trigger the behavior you're describing. Don't forget to describe in detail the behavior you desire, too.

                          -- tom


                          • #14
                            Re: Help with Progressive Find dialog

                            Thanks Tom for stepping in. I greatly respect your advice, not that I don't appreciate or respect the advice I have already been given.

                            I did post an example earlier in the tmp_zip attachment. I am heading in to the office, but will post a reply later today with the information you are requesting.

                            I just need one 'small' change in my dialog.

                            I now have to click on a row to populate the search variable. If it is possible I would like the first row of the list items to automatically populate the search variable - without having to click on it. This is not a big deal just seems that it would be a nice improvement to the Progressive find or in my case Search_Name.
                            David Montgomery


                            • #15
                              Re: Help with Progressive Find dialog

                              Right. I see the zip file now. Missed it earlier. Will take a look.

                              Later...Path to the table in your database prevented table from being loaded with database. Dropped table. Added "Clients" table to the database.

                              Script wants to run against a table calld "All_clients" (I think). Wouldnt run in your sample cause table is named "Clients", if I've "added" the right table. Changed script to refer to "Clients" table and it now displays the records.

                              Will look further.

                              Still later on ...Sorry. Can't help you. The xdialog statements that populate, sort, and select rows in your listview object are not documented well enough in the help file for me to understand what's going on in your script. These are advanced xdialog statements which I am unable to translate or use. Sorry.
                              Last edited by Tom Cone Jr; 05-14-2009, 11:53 AM.