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

Progressive Find: Go To Record doesn't "Go to Record"

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

  • Progressive Find: Go To Record doesn't "Go to Record"

    Hello all, I have been working on this progressive find for the database I am working on, using the AlphaSports example as a guide. I've searched the forums too and it helped a little.

    I initially started using ActionScript, but ended up converting it into xBasic because I wanted to change something. Now I realize I can't go back, and am stuck trying to do this in xBasic :O

    My button on a form, when clicked plays this 'progressive find' script. When I click the "Go To Record" button or double click one of the entries, it should go to that particular record on the form. At the moment, when I click on the Go To Record button, I get an error saying:
    "Script:UI_DLG_BOX:Lookup Work Order line:44 t.fetch_goto(FindRecNoForIssue_Count(vIssue_Count)) Function is not recognized"


    Any thoughts on how I can make my Go To Record button actually go to the corresponding record? (I would like it to do the same thing when double-clicking the entry too). I'm not sure why my function is not recognized.

    Any help appreciated!

    Here is the code:


    Code:
    'Create an XDialog dialog box to prompt for work order number
    DIM SHARED Issue_Count as C
    DIM SHARED varC_result as C
    DIM Listbox_FuncCode AS C = <<%CodeFunctions%
    FUNCTION DoSort AS C (byref CurrentSortField AS C , byref CurrentSortDirection AS C, NewSortField AS C, pTableDef AS P,  arrContents 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
    	arrContents.sort(SortDirection, stritran(SortField, "->", "__"))
    	cResult = DumpContents(pTableDef, arrContents)
    	
    	DoSort = cResult
    END FUNCTION
    
    
    FUNCTION GetContents AS C ( pTableDef AS P, arrContents AS P, lv AS P )
    	DIM cResult AS C
    	
    	arrContents.Clear()
    
    	DIM FieldList AS C 
    	DIM Content_Expression AS C
    	DIM t AS P
    	DIM Filter AS C
    	DIM arrTemp[1] AS P
    
    	IF .NOT. file.exists(table.filename_get(pTableDef.TableName))
    		EXIT FUNCTION
    	END IF
    		
    	t = table.open(pTableDef.TableName, FILE_RO_SHARED)
    	arrContents.resize(t.records_get())
    	arrTemp.resize(arrContents.size())
    	t.close()
    
    	Filter = pTableDef.Filter
    	Filter = GetArguments(pTableDef, lv)
    
    	Filter = convert_expression( Filter, "VC","",lv)
    
    '	arrContents.initialize_from_Table(pTableDef.TableName, Filter, pTableDef.Order)
    	arrTemp.initialize_from_Table(pTableDef.TableName, Filter, pTableDef.Order)
    	arrContents.resize(arrTemp.size())
    	arrContents.copy_from(arrTemp)
    
    
    
    	cResult = DumpContents(pTableDef, arrContents)
    	GetContents = cResult
    END FUNCTION
    
    
    
    FUNCTION DumpContents AS C ( pTableDef AS P, arrContents AS P )
    	DIM cResult AS C
    	DIM cEval AS C
    
    	pTableDef.FieldList	= alltrim(pTableDef.FieldList)
    
    	IF pTableDef.FieldList = ""
    		EXIT FUNCTION
    	END IF
    	
    	cEval = *for_each(x, "TrimCRLFs(x." + stritran(table.name_normalize(x),"->", "__")+")", pTableDef.FieldList)
    	cEval = alltrim(cEval)
    	cEval = stritran(cEval, crlf(), "+"+quote("|")+ "+")
    	IF pTableDef.ReturnValueExpression <> ""
    		cEval = quote("{DATA=") + " + TrimCRLFs(x." + stritran(table.name_normalize(pTableDef.ReturnValueExpression),"->", "__") + ")+" + quote("}")+ "+" + cEval
    	END IF
    	
    	cEval = "*for_each(x, " + cEval + ", arrContents)"
    	cResult = eval(cEval)
    	cResult = a5_owner_draw_list_fmt(cResult, pTableDef.pAdvFormatting, "listview")
    
    	DumpContents = cResult	
    END FUNCTION
    
    FUNCTION TrimCRLFs AS A ( data AS A )
    	IF typeof(data) = "C"
    		TrimCRLFs = stritran(data, crlf(), " ")
    	ELSE
    		TrimCRLFs = data
    	END IF
    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 Listbox_Funcs AS P = compile_template(Listbox_FuncCode)
    DIM Listbox_arrContents[1] AS P
    
    DIM SHARED  Listbox AS C
    DIM Listbox_CurrentSortField AS C = "Issue_Count"
    DIM Listbox_CurrentSortDirection AS C = "A"
    
    DIM Listbox_pTableDef AS P
    DIM Listbox_pTableDef.ReturnValueExpression AS C = "Issue_count"
    DIM Listbox_pTableDef.FieldList AS C = <<%txt%
    Issue_count
    Time
    Completed
    Person_Calling
    Company
    Subject
    %txt%
    DIM Listbox_pTableDef.TitleRow AS C = "{AUTOSIZEHEAD}WO #|{AUTOSIZE}Time|{AUTOSIZE}Complete?|{AUTOSIZE}Person Calling|{AUTOSIZE}Company|{AUTOSIZE}Subject"
    DIM Listbox_pTableDef.Arguments AS C = <<%txt%
    <lastbutton="cancel">
    <arrArgs<[1]<Name="argIssue_Count">
    <DataType="Character">
    <Source="Variable">
    <SourceDisplay="Get value from variable">
    <VariableScope="Session Variable">
    <VariableName="Issue_Count">
    <VariableWithScope="Issue_Count (Session Variable)">
    <DefaultValue="">
    <Prompt=.F.>
    <PromptText="">
    <PromptControlType="Text Box">
    <PromptChoices="">
    <PromptDlgTitle="Missing Argument">
    <PromptTextAbove="">
    <PreviewValue="">
    >
    >
    %txt%
    DIM Listbox_pTableDef.pArgs AS P
    property_from_string(Listbox_pTableDef.pArgs, Listbox_pTableDef.Arguments)
    DIM Listbox_pTableDef.TableName AS C = "hosted_downtown"
    DIM Listbox_pTableDef.Filter AS C = "left(issue_count, len(:argIssue_Count)) = :argIssue_Count .AND. (recno() > 0)"	' recno() > 0 is required in order to avoid showing deleted variables
    DIM Listbox_pTableDef.Order AS C = "Issue_Count"
    DIM Listbox_pTableDef.pAdvFormatting AS P
    DIM Listbox_pTableDef.pAdvFormatting.alternating_bands AS L = .t.
    DIM Listbox_pTableDef.pAdvFormatting.group_size AS N = 1
    DIM Listbox_pTableDef.pAdvFormatting.odd_row_color AS C = "White"
    DIM Listbox_pTableDef.pAdvFormatting.even_row_color AS C = "#240+255+234"
    DIM Listbox_pTableDef.pAdvFormatting.odd_selected_color AS C = "Dark Blue"
    DIM Listbox_pTableDef.pAdvFormatting.even_selected_color AS C = "Dark Blue"
    DIM Listbox_pTableDef.pAdvFormatting.font AS C = "Arial,8"
    DIM Listbox_pTableDef.pAdvFormatting.font_color_unselected AS C = "Black"
    DIM Listbox_pTableDef.pAdvFormatting.font_color_selected AS C = "White"
    DIM Listbox_pTableDef.pAdvFormatting.number_rows AS L = .f.
    DIM Listbox_pTableDef.pAdvFormatting.tab_stops AS C = ""
    
    
    Listbox_pLV.titlerow = Listbox_pTableDef.titlerow
    Listbox_pLV.titleevents = "Listbox_Sort_Issue_count|Listbox_Sort_Time|Listbox_Sort_Completed|Listbox_Sort_Person_Calling|Listbox_Sort_Company|Listbox_Sort_Subject"
    Listbox_pLV.style = "report,singlesel,showselalways,fullrowselect"
    Listbox_pLV.dragbehaviour = ""
    Listbox_pLV.dropbehaviour = ""
    Listbox_pLV.contents = Listbox_Funcs.GetContents(Listbox_pTableDef, Listbox_arrContents, local_variables())
    
    Listbox_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 )
    	
    		'to call a function outside the events code, you must use the ui_dlg_eval() function
    		'menu = ui_dlg_eval(dlg_title,"a5wcb_PublishRclick(selectedFilename)")
    		
    '		ui_msg_box("OnRightClick",listview.selection)
    	END WITH
    end function	
    			
    function OnDoubleClick as c(lv as p,listView as p,args as p)
    	WITH lv
    		Listbox  = listView.GetRowValue(args.GetClickRow())
    		'ui_msg_box("On Double Click",Listbox)
    'COMMENT OUT IF NO-GO 
    		t = topparent.table_get()
    		dim recno_for_issue_count as c
    		recno_for_issue_count = ui_dlg_eval(dlg_title,"FindRecNoForIssue_Count(vIssue_Count)")
    		t.fetch_goto(recno_for_issue_count)
    		topparent.resynch()
    
    		if flagCloseAfterFind then
    		    	ui_dlg_event(dlg_title,"Close")
    		
    		end if
    		
    'END EDITED CODE		
    	END WITH
    end function	
    
    'new code 
    FUNCTION FindRecNoForIssue_Count AS C (vIssue_Count AS C )
    	DIM t AS P
    	DIM nResult AS N
    
    	t = table.open("hosted_downtown", FILE_RO_SHARED)
    	t.order("Issue_Count")
    	nResult = t.fetch_find(vIssue_Count)
    	t.close()
    
    	FindRecNoForIssue_Count() = nResult
    	?nresult	
    END FUNCTION
    
    	
    	
    	
    	
    FUNCTION OnSelectionChanged AS V (lv AS P, listView as p )
    	WITH lv
    		Listbox = listView.Selection
    '		ui_msg_box("OnSelectionChanged",Listbox)
    	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
    	
    	'ui_msg_box("OnKeyDown", KeyName)
    END FUNCTION
    %code%
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Lookup Work Order",<<%dlg%
    {region}
    Work Order #:| [.40Issue_Count];
    | {listviewcustom=125,30Listbox^=Listbox_pLV};
    {watch=Issue_Count!Listbox_refresh}
    {watch=Listbox!foo};
    <*%T= Bubble help for button;%Go To Record!GoToRecord_button_click>
    {endregion};
    {line=1,0};
    {region}
    <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    IF left(a_dlg_button, len("Listbox_Sort_")) = "Listbox_Sort_"
    	DIM NewSortField AS C
    	NewSortField = substr(a_dlg_button, len("Listbox_Sort_")+1)
    	Listbox_pLV.Contents = Listbox_Funcs.DoSort(Listbox_CurrentSortField, Listbox_CurrentSortDirection, NewSortField, Listbox_pTableDef, Listbox_arrContents)
    	a_dlg_button = ""
    END IF
    
    
    IF a_Dlg_button = "Listbox_refresh"
    	a_dlg_button = ""
    
    	Listbox_pLV.contents = Listbox_Funcs.GetContents(Listbox_pTableDef, Listbox_arrContents, local_variables())
    END IF
    
    IF a_dlg_button = "foo"
    	a_dlg_button = ""
    	' do nothing
    END IF
    
    'IF a_dlg_button = "goto_record"
    '	a_dlg_button = ""
    '	t = topparent.Table_Get()
    '	t.fetch_goto(FindRecNoForIssue_Count(vIssue_Count))
    '	topparent.resynch()
    '	if flagCloseAfterFind then
    '	    	ui_modeless_dlg_close(dlg_title)
    '	end if
    'end if
    
    	if a_dlg_button = "GoToRecord_button_click" then 
    	a_dlg_button = ""
    	t = topparent.Table_Get()
    	t.fetch_goto(FindRecNoForIssue_Count(vIssue_Count))
    	topparent.resynch()
    	if flagCloseAfterFind then
    	    	ui_modeless_dlg_close(dlg_title)
    	 
    	end if
    		
    	end if
    %code%)

  • #2
    Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

    Hi Alston,

    Start over and build a new dialog. Also, make sure you have an Index built on the Work Order Number.

    In the action script, add Set Index to WON.

    Next add Goto Record Key, this will be the variable from the result value of the dialog.

    So that is 3 items in your action script, which should not take you more than 10 minutes to set up.

    Good luck.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


    • #3
      Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

      Alston,
      Is that your name? How many records do you anticipate being in your application that the Progressive find will address? I ask because there are other more approachable methods, without all the fancy formatting, but depends on whether you are search through 1000 or 100,000 records on how to approach it.
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


      • #4
        Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

        Originally posted by Keith Hubert View Post
        Hi Alston,

        Start over and build a new dialog. Also, make sure you have an Index built on the Work Order Number.

        In the action script, add Set Index to WON.

        Next add Goto Record Key, this will be the variable from the result value of the dialog.

        So that is 3 items in your action script, which should not take you more than 10 minutes to set up.

        Good luck.

        Hi Keith,

        I tried to follow your steps. For the On Push even for my button, I have added 3 actions. However, this time instead of receiving an error when trying to go to a record, the dialog box closes and does nothing... If only I were pro at Alpha, I could maybe do it in 10 minutes!

        Thanks for the help!

        1.
        Code:
        'Set the index to : 'Issue_Count' in  current window.
        topparent.Index_SetExplicit("Issue_Count")
        2.
        Code:
        'Create an XDialog dialog box to prompt for parameters.
        DIM SHARED WON as C
        DIM SHARED varI_result as C
        DIM WONlist_FuncCode AS C = <<%CodeFunctions%
        FUNCTION DoSort AS C (byref CurrentSortField AS C , byref CurrentSortDirection AS C, NewSortField AS C, pTableDef AS P,  arrContents 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
        	arrContents.sort(SortDirection, stritran(SortField, "->", "__"))
        	cResult = DumpContents(pTableDef, arrContents)
        	
        	DoSort = cResult
        END FUNCTION
        
        
        FUNCTION GetContents AS C ( pTableDef AS P, arrContents AS P, lv AS P )
        	DIM cResult AS C
        	
        	arrContents.Clear()
        
        	DIM FieldList AS C 
        	DIM Content_Expression AS C
        	DIM t AS P
        	DIM Filter AS C
        	DIM arrTemp[1] AS P
        
        	IF .NOT. file.exists(table.filename_get(pTableDef.TableName))
        		EXIT FUNCTION
        	END IF
        		
        	t = table.open(pTableDef.TableName, FILE_RO_SHARED)
        	arrContents.resize(t.records_get())
        	arrTemp.resize(arrContents.size())
        	t.close()
        
        	Filter = pTableDef.Filter
        	Filter = GetArguments(pTableDef, lv)
        
        	Filter = convert_expression( Filter, "VC","",lv)
        
        '	arrContents.initialize_from_Table(pTableDef.TableName, Filter, pTableDef.Order)
        	arrTemp.initialize_from_Table(pTableDef.TableName, Filter, pTableDef.Order)
        	arrContents.resize(arrTemp.size())
        	arrContents.copy_from(arrTemp)
        
        
        
        	cResult = DumpContents(pTableDef, arrContents)
        	GetContents = cResult
        END FUNCTION
        
        
        
        FUNCTION DumpContents AS C ( pTableDef AS P, arrContents AS P )
        	DIM cResult AS C
        	DIM cEval AS C
        
        	pTableDef.FieldList	= alltrim(pTableDef.FieldList)
        
        	IF pTableDef.FieldList = ""
        		EXIT FUNCTION
        	END IF
        	
        	cEval = *for_each(x, "TrimCRLFs(x." + stritran(table.name_normalize(x),"->", "__")+")", pTableDef.FieldList)
        	cEval = alltrim(cEval)
        	cEval = stritran(cEval, crlf(), "+"+quote("|")+ "+")
        	IF pTableDef.ReturnValueExpression <> ""
        		cEval = quote("{DATA=") + " + TrimCRLFs(x." + stritran(table.name_normalize(pTableDef.ReturnValueExpression),"->", "__") + ")+" + quote("}")+ "+" + cEval
        	END IF
        	
        	cEval = "*for_each(x, " + cEval + ", arrContents)"
        	cResult = eval(cEval)
        	cResult = a5_owner_draw_list_fmt(cResult, pTableDef.pAdvFormatting, "listview")
        
        	DumpContents = cResult	
        END FUNCTION
        
        FUNCTION TrimCRLFs AS A ( data AS A )
        	IF typeof(data) = "C"
        		TrimCRLFs = stritran(data, crlf(), " ")
        	ELSE
        		TrimCRLFs = data
        	END IF
        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 WONlist_Funcs AS P = compile_template(WONlist_FuncCode)
        DIM WONlist_arrContents[1] AS P
        
        DIM SHARED  WONlist AS C
        DIM WONlist_CurrentSortField AS C = "Issue_count"
        DIM WONlist_CurrentSortDirection AS C = "A"
        
        DIM WONlist_pTableDef AS P
        DIM WONlist_pTableDef.ReturnValueExpression AS C = "Issue_count"
        DIM WONlist_pTableDef.FieldList AS C = <<%txt%
        Issue_count
        Completed
        Subject
        Person_calling
        Time
        Company
        %txt%
        DIM WONlist_pTableDef.TitleRow AS C = "{WIDTH=0.6}WO #|{AUTOSIZE}Completed|{AUTOSIZE}Subject|{AUTOSIZE}Person_calling|{AUTOSIZE}Time|{AUTOSIZE}Company"
        DIM WONlist_pTableDef.Arguments AS C = <<%txt%
        <lastbutton="ok">
        <arrArgs<[1]<Name="WONarg">
        <DataType="Character">
        <Source="Variable">
        <SourceDisplay="Get value from variable">
        <VariableScope="Session Variable">
        <VariableName="WON">
        <VariableWithScope="WON (Session Variable)">
        <DefaultValue="">
        <Prompt=.F.>
        <PromptText="">
        <PromptControlType="Text Box">
        <PromptChoices="">
        <PromptDlgTitle="Missing Argument">
        <PromptTextAbove="">
        <PreviewValue="">
        >
        >
        %txt%
        DIM WONlist_pTableDef.pArgs AS P
        property_from_string(WONlist_pTableDef.pArgs, WONlist_pTableDef.Arguments)
        DIM WONlist_pTableDef.TableName AS C = "hosted_downtown"
        DIM WONlist_pTableDef.Filter AS C = "left(Issue_Count, len(:WONarg)) = :WONarg .AND. (recno() > 0)"	' recno() > 0 is required in order to avoid showing deleted variables
        DIM WONlist_pTableDef.Order AS C = "Issue_count"
        DIM WONlist_pTableDef.pAdvFormatting AS P
        DIM WONlist_pTableDef.pAdvFormatting.alternating_bands AS L = .t.
        DIM WONlist_pTableDef.pAdvFormatting.group_size AS N = 1
        DIM WONlist_pTableDef.pAdvFormatting.odd_row_color AS C = "White"
        DIM WONlist_pTableDef.pAdvFormatting.even_row_color AS C = "#223+253+200"
        DIM WONlist_pTableDef.pAdvFormatting.odd_selected_color AS C = "Dark Blue"
        DIM WONlist_pTableDef.pAdvFormatting.even_selected_color AS C = "Dark Blue"
        DIM WONlist_pTableDef.pAdvFormatting.font AS C = "Arial,8"
        DIM WONlist_pTableDef.pAdvFormatting.font_color_unselected AS C = "Black"
        DIM WONlist_pTableDef.pAdvFormatting.font_color_selected AS C = "White"
        DIM WONlist_pTableDef.pAdvFormatting.number_rows AS L = .f.
        DIM WONlist_pTableDef.pAdvFormatting.tab_stops AS C = ""
        
        
        WONlist_pLV.titlerow = WONlist_pTableDef.titlerow
        WONlist_pLV.titleevents = "WONlist_Sort_Issue_count|WONlist_Sort_Completed|WONlist_Sort_Subject|WONlist_Sort_Person_calling|WONlist_Sort_Time|WONlist_Sort_Company"
        WONlist_pLV.style = "report,singlesel,showselalways,fullrowselect"
        WONlist_pLV.dragbehaviour = ""
        WONlist_pLV.dropbehaviour = ""
        WONlist_pLV.contents = WONlist_Funcs.GetContents(WONlist_pTableDef, WONlist_arrContents, local_variables())
        
        WONlist_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 )
        	
        		'to call a function outside the events code, you must use the ui_dlg_eval() function
        		'menu = ui_dlg_eval(dlg_title,"a5wcb_PublishRclick(selectedFilename)")
        		
        '		ui_msg_box("OnRightClick",listview.selection)
        	END WITH
        end function	
        			
        function OnDoubleClick as c(lv as p,listView as p,args as p)
        	WITH lv
        		WONlist  = listView.GetRowValue(args.GetClickRow())
        '		ui_msg_box("OnDoubleClick",WONlist)
        	END WITH
        end function	
        	
        FUNCTION OnSelectionChanged AS V (lv AS P, listView as p )
        	WITH lv
        		WONlist = listView.Selection
        '		ui_msg_box("OnSelectionChanged",WONlist)
        	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
        	
        	'ui_msg_box("OnKeyDown", KeyName)
        END FUNCTION
        %code%
        ok_button_label = "&OK"
        cancel_button_label = "&Cancel"
        varI_result = ui_dlg_box("Alpha Five",<<%dlg%
        {region}
        Work Order #:| [.40WON];
        | {listviewcustom=160,45WONlist^=WONlist_pLV};
        {watch=WON!WONlist_refresh}
        {watch=WONlist!foo};
        {endregion};
        {line=1,0};
        {region}
        <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
        {endregion};
        %dlg%,<<%code%
        IF left(a_dlg_button, len("WONlist_Sort_")) = "WONlist_Sort_"
        	DIM NewSortField AS C
        	NewSortField = substr(a_dlg_button, len("WONlist_Sort_")+1)
        	WONlist_pLV.Contents = WONlist_Funcs.DoSort(WONlist_CurrentSortField, WONlist_CurrentSortDirection, NewSortField, WONlist_pTableDef, WONlist_arrContents)
        	a_dlg_button = ""
        END IF
        
        
        IF a_Dlg_button = "WONlist_refresh"
        	a_dlg_button = ""
        
        	WONlist_pLV.contents = WONlist_Funcs.GetContents(WONlist_pTableDef, WONlist_arrContents, local_variables())
        END IF
        
        IF a_dlg_button = "foo"
        	a_dlg_button = ""
        	' do nothing
        END IF
        %code%)

        3.
        Code:
        'Goto record with specified key value in current form.
        DELETE var_key_target 
        var_key_target = varI_result
        
        topparent.find(var_key_target)

        Comment


        • #5
          Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

          Hi Alston,

          If you have given the code here in the order you have them in your app, then swap 1 and 2.

          The dialog should be first, then you set the index, then you goto the record where the value from the dialog is equal to the key in the index.

          Just to be sure, is the index Issue_count on the same field as varI_result?
          Regards
          Keith Hubert
          Alpha Guild Member
          London.
          KHDB Management Systems
          Skype = keith.hubert


          For your day-to-day Needs, you Need an Alpha Database!

          Comment


          • #6
            Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

            Too much code and not enough visuals for me.
            Can you post a copy of where you are, and what you actually need to achieve?
            As Mike says, there are "Options".
            I prefer to avoid coding and only use it (with a lot of help from the Forum) as a last resort.
            Built in facilities should make this a simple task, but I've been wrong before.
            See our Hybrid Option here;
            https://hybridapps.example-software.com/


            There are 3 things you can do in any situation;
            Live with it, Change it or Walk away from it.

            Comment


            • #7
              Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

              Hi Ted,

              I realise that you dont like too much code but that is the only way to show on the forum what alpha has created from action scripting. Also it is good to get to grips with some of the power of Xbasic.

              Here is the code I have, it does what has been asked and works very well and is only 30 lines of code.
              Code:
              'Create an XDialog dialog box to prompt for parameters.   
              DIM SHARED vc_name as C
              DIM SHARED vc_list as C
              DIM SHARED varC_result as C
              ok_button_label = "&OK"
              cancel_button_label = "&Cancel"
              DIM vc_list_rl_def_orig as C 
              vc_list_rl_def_orig = "kl=custodian,{keylist_build(\"H=.05,1:25[First_Name],2:25[Last_Name],3:25[Addr1],4:25[Post_Code]\",''+cust_id,left(''+first_name,25),left(''+last_name,25),left(''+addr1,25),left(''+post_code,25))}{left(Last_Name,len([varC->vc_name]))=[varC->vc_name]}"
              DIM vc_list_rl_def as C 
              vc_list_rl_def = replace_parameters(vc_list_rl_def_orig,local_variables())
              varC_result = ui_dlg_box("Find Custodian",<<%dlg%
              {region}
              Type Last Name here:| [.40vc_name!vc_name_changed];
              | [%@vc_list_rl_def%.100,30vc_list];
              {endregion};
              {line=1,0};
              {region}
              <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
              {endregion};
              %dlg%,<<%code%
              If a_dlg_button = "vc_name_changed" then 
              	vc_list_rl_def = replace_parameters(vc_list_rl_def_orig,local_variables())
              	a_dlg_button = ""
              end if
              %code%)
              
              'Set the index to : 'Cust_Id2' in  current window.
              topparent.Index_SetExplicit("Cust_Id2")
              
              'Goto record with specified key value in current form at parent level.
              DELETE var_key_target 
              var_key_target = vc_list
              
              topparent.find(var_key_target)
              Comparing the code, it does not look like you have got the correct dialog. See attachment, does yours look like mine?
              Attached Files
              Last edited by Keith Hubert; 07-26-2011, 05:52 AM. Reason: Added iamge
              Regards
              Keith Hubert
              Alpha Guild Member
              London.
              KHDB Management Systems
              Skype = keith.hubert


              For your day-to-day Needs, you Need an Alpha Database!

              Comment


              • #8
                Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

                Thanks Keith, can you ping me a copy of the table this runs against so I can study/learn from it?
                See our Hybrid Option here;
                https://hybridapps.example-software.com/


                There are 3 things you can do in any situation;
                Live with it, Change it or Walk away from it.

                Comment


                • #9
                  Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

                  Got it.
                  The way I set this up was to create a Query which used a Variable on the Form as the base search criteria.
                  Less code, but not so fancy I suspect as far as presentation as the default Query Browse appears.
                  See our Hybrid Option here;
                  https://hybridapps.example-software.com/


                  There are 3 things you can do in any situation;
                  Live with it, Change it or Walk away from it.

                  Comment


                  • #10
                    Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

                    Keith, I have swapped actions 1 & 2. Still does nothing. How do I verify the Issue_Count is on the same field as varI_result? The Result Variable, varI_result, is the same variable I have specified in the Goto Record Key, if that's what you mean... If it is of any help, the form is based on a table called "Hosted_Downtown." In that table I have a field called Issue_Count (an auto-increment character type field). In the Indexes for the Hosted_Downtown table, I have the following under Indexes:

                    Company | COMPANY | Ascending | All
                    Issue_Count | ISSUE_COUNT | Ascending | Unique only


                    Also in my 'Display an Xdialog Box action, I have two variables: WON, which is Character type and Text box Style. The second variable is WONlist, which is Character type and List View Control style. Perhaps something is wrong here?

                    I have attached some visuals.

                    ListView.jpg


                    I already have two separate buttons. One allows me to enter the Issue_Count number, and it will go to that specific record. The other button will search all fields for a specific keyword, and go to the first record it finds. The problem with this, is that I can't view all records and pertinent details beforehand containing this keyword. This progressive lookup feature allows me to see all Issue Counts along with details for each record, before going to it. It filters based on the Issue_Count number. Now ideally, I would like to have a search box that would search all fields for a specific keyword, and narrow the search results. I anticipate this progressive find will filter around say thousands of records. At most in the tens of thousands...but that won't be for years to come. But I figured that would be a daunting task, so I thought I would start "easy" by just filtering by the Issue_Count number.

                    Issue_Count.jpg

                    Comment


                    • #11
                      Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

                      Hi, here is code that I created to work against Alphasports Customer table.
                      Code:
                      'Create an XDialog dialog box to prompt for parameters.
                      
                      DIM SHARED vc_name as C
                      DIM global vc_list as C
                      DIM SHARED varC_result as C
                      ok_button_label = "&OK"
                      cancel_button_label = "&Cancel"
                      DIM vc_list_rl_def_orig as C 
                      vc_list_rl_def_orig = "kl=customer,{keylist_build(\"H=.05,1:25[Lastname],2:25[Firstname],3:25[Bill_Address_1]\",''+customer_id,left(''+lastname,25),left(''+firstname,25),left(''+bill_address_1,25))}{left(LastName,len([varC->vc_name]))=[varC->vc_name]}"
                      DIM vc_list_rl_def as C 
                      vc_list_rl_def = replace_parameters(vc_list_rl_def_orig,local_variables())
                      varC_result = ui_dlg_box("Alpha Five",<<%dlg%
                      {region}
                      Type name here:| [.40vc_name!vc_name_changed];
                      | [%@vc_list_rl_def%.100,20vc_list];
                      {endregion};
                      {line=1,0};
                      {region}
                      <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
                      {endregion};
                      %dlg%,<<%code%
                      If a_dlg_button = "vc_name_changed" then 
                      	vc_list_rl_def = replace_parameters(vc_list_rl_def_orig,local_variables())
                      	a_dlg_button = ""
                      end if
                      %code%)
                      
                      'Set the index to : 'Customer_I' in  current window.
                      topparent.Index_SetExplicit("Customer_I")
                      
                      'Goto record with specified key value in current form at parent level.
                      DELETE var_key_target 
                      var_key_target = vc_list
                      
                      topparent.find(var_key_target)
                      Put this on a button on the Customer Information form. Run it, then look at the variables in the Interactive window.

                      Notice that Goto instruction is taking the value of vc_list and going to the value in the index Customer_I.

                      Are you useing dialog Record List-List Box?
                      Last edited by Keith Hubert; 07-26-2011, 02:09 PM.
                      Regards
                      Keith Hubert
                      Alpha Guild Member
                      London.
                      KHDB Management Systems
                      Skype = keith.hubert


                      For your day-to-day Needs, you Need an Alpha Database!

                      Comment


                      • #12
                        Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

                        Hmm...I'm getting an error for some reason, "Script:TEMPLATE line:29 topparent.Index_SetExplicit("Customer_I") property not found"

                        propertyNotFound.jpg

                        Comment


                        • #13
                          Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

                          Oh and I am using the "List View Control" not the Record List-List Box

                          Comment


                          • #14
                            Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

                            At risk of confusing the issue, I have attached a Db with essentially 3 forms.
                            Form 1 is the Search Form (Search_1). There is a list of names to choose from, however entering the name in the Variable (identified clearly) and running the Query will open a form with matching data.
                            Double click on the line you want, and a third form opens with the person specific data.
                            The Query was built using Action Scripting, and is based upon the content of the Variable field added to the Serach_1 Form.
                            Suggest you look at the Script in the Code section, as this is the modified Query (Copy Xbasic and redirect to the Form of your choice).
                            I do not use the %dialog% stuff as I believe that it is possible to create simple dialog using the standard tools. (%dialog% gives a nicer result but is time consuming, and when Prototyping, the Client doesn't want to wait for coding.)
                            Attached Files
                            See our Hybrid Option here;
                            https://hybridapps.example-software.com/


                            There are 3 things you can do in any situation;
                            Live with it, Change it or Walk away from it.

                            Comment


                            • #15
                              Re: Progressive Find: Go To Record doesn't &quot;Go to Record&quot;

                              I have been following this thread and I see several things. One is that Alston is using the Action scripting "List View Control". Well, I haven't seen anyone able to help you Alston, and that is probably because that List View Control is an enourmously intricate and highly complex code that VERY few actually can read and understand. I know I certainly cannot come close to interpretting that code to much success beyond what I have in the thread I posted (see link below). So I have chosen not to use it and I can't help you with it much. Good luck finding someone who can. I also see others giving you other methods other than the List View Control method. This follows the same reason.... other methods are more comprehensible to customize.

                              I also don't see that you have clearly demonstrated what the ouput value of the dialog choice is to assure the find by index error is not based upon trying to find a nonsense index value. I think if you posted a copy of your app with the table this progressive find is working off of, we could help you more. Otherwise maybe this thread can help you.

                              http://msgboard.alphasoftware.com/al...ht=progressive
                              Mike W
                              __________________________
                              "I rebel in at least small things to express to the world that I have not completely surrendered"

                              Comment

                              Working...
                              X