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

Is there way to load the form directly rather from the dblclick on browse?

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

    Is there way to load the form directly rather from the dblclick on browse?

    Is there way to simplify this little more.

    When my search box appears on clicking "Ok" I would like the customer form to show up rather than opening the form from double click on the browse?

    I know that I have to use
    Attached Files

    #2
    Re: Is there way to load the form directly rather from the dblclick on browse?

    Backup two_param_lookup() function then copy/Paste this into the function two_param_lookup().

    Code:
    'Date Created: 01-Aug-2010 10:54:30 PM
    'Last Updated: 03-Aug-2010 02:17:16 PM
    'Created By  : j michael wilson
    'Updated By  : j michael wilson
    
    
    FUNCTION two_param_lookup AS C ( )
    	
    dim global vproceed as C="yes"
    
    dim vL_names as C
    dim vLn as C
    dim vL_show as C
    vL_names=table.external_record_content_get("customer","lastname+' '+firstname+' '+phone","lastname","")
    vLn=table.external_record_content_get("customer","customer_id","lastname","")
    vL_show=vL_names
    
    dim vfind_ln as C
    dim vfind_fn as C
    dim vpick as C=""
    dim vR as C
    dim vctrl_fn as C="[.30vfind_l!evln_*]"
    dim vctrl_ln as C="[.30vfind_f!evfn_*]"
    
    vR=ui_dlg_box("Customer",<<%dlg%
    {font=courier,10}
    {lf};
    Search Name:;
    LAST NAME:[.30vfind_ln!evln_*];
    FIRST NAME:[.30vfind_fn!evfn_*];
    {lf};
    [.90,10vpick^#vL_show];
    {lf};
    Pick:;
    [.50vpick!evp_*];
    {lf};
    {line=1,0}
    {lf};
    <15OK> <15Cancel>
    %dlg%,<<%code%
    
    '--------------
    'Added by Andrew
    If a_dlg_button = "OK"
    	'ui_msg_box("","Ok pressed"+crlf()+vpick)
    	DIM vFlagC as C
    	vFlagC = "OK"
    END IF
    'End of Added code
    '--------------
    
    
    'field event
    IF left(a_dlg_button,5)="evln_"
    	if a_dlg_button="evln_change"
    		vpick=""
    		vL_show=filter_string_smatch(vL_names,vfind_ln+"*",crlf())
    	end if
    	a_dlg_button=""
    END IF
    
    IF left(a_dlg_button,5)="evfn_"
    	if a_dlg_button="evfn_change"
    		vpick=""
    		vL_show=filter_string_smatch(vL_show,vfind_ln+"* "+vfind_fn+"*",crlf())
    	end if
       a_dlg_button=""
    END IF
    
    IF a_dlg_button="Cancel"
    	a_dlg_button="close"
    END IF	
    %code%)
    
    if vR="cancel"
    	vproceed="no"
    	end 
    end if
    '--------------
    'edited by Andrew
    IF vFlagC = "OK" THEN
    	dim shared vCID as C
    	vCID=word(vLn,word_number_get(vL_names,vpick,crlf()),crlf())
    	'msgbox("customer_number",vCID)
    	'----------------
    	'Copy/Paste from Action Script found on browse double click event
    	'Open a Form or Browse layout, displaying all, or selected records in the layout.
    	'Check to see if you are running the script from within a Form
    	dim flag_error as l
    	flag_error = .f.
    	'Do not need to test if the form exists or if the field.value is valid
    '	if is_object(topparent.this) then 
    '		p = topparent.this
    '		
    '		if eval_valid("P:BROWSE1:Customer_id.value") then 
    '			DELETE Parameter1 
    '			'Set the Parameter variable to the object's .value property
    '			Parameter1 = eval("P:BROWSE1:Customer_id.value")
    '		else
    '			flag_error = .t.
    '		end if 
    '	else
    '		flag_error = .t.
    '	end if 
    '	
    '	if flag_error then 
    '		ui_msg_box("Error","BROWSE1:Customer_id does not exist. This script cannot be run in this context.",UI_STOP_SYMBOL)
    '		end 
    '	end if 
    	
    	
    	'filter = "customer_id = [varC->parameter1]"
    	filter = "customer_id = " + s_quote(vCID)		'vCId is set on line 83; s_quote will wrap the value of vCID in quotation marks
    	query.filter = replace_parameters(filter,local_variables())
    	query.order = ""
    	
    	
    	'Open the layout_type showing just the records that satisfy the filter
    	DIM Shared varP_customer as P
    	DIM layout_name as c 
    	layout_name = "customer"
    	
    	
    	dim tempP as p
    	'Get pointer to existing window. In case layout_name is qualified with a dictionary name, extract up to first @. In case formname has spaces, normalize it
    	tempP=obj(":"+object_name_normalize(word(layout_name,1,"@")))
    	'Test if pointer is valid
    	if is_object(tempP) then 
    		'Test if pointer refers to a form or browse
    		if tempP.class() = "form" .or. tempP.class() = "browse" then 
    					dim flagIsBaseFilter as l 
    			flagIsBaseQuery = .t.
    	
    			
    			if flagIsBaseFilter then 
    				'Apply the query to the form or browse as the Base query. (this means that 
    				'the user cannot turn the query off, only add to the query)
    				tempP.BaseQueryRun(query.filter,query.order)
    			else
    				tempP.QueryRun(query.filter,query.order)		
    				
    			end if 
    			
    			'then activate the already open window
    			tempP.activate()
    		else
    			'Window is not already open, so open it
    			varP_customer = :Form.viewqueried(layout_name,query.filter, query.order )
    	
    		end if
    	else 
    		
    		varP_customer = :Form.viewqueried(layout_name,query.filter, query.order )
    	
    	end if
    	
    	'End of Action Script copy/paste
    	'----------------
    	
    END IF
    'End of edit
    '------------
    
    END FUNCTION
    Andrew

    Comment


      #3
      Re: Is there way to load the form directly rather from the dblclick on browse?

      Hi Andrew!

      Thanks a lot for your help! It is a great search funtion to implement. I will give a shot with my original project. I gotta study this code.

      I will keep you updated.

      Mark

      Comment


        #4
        Re: Is there way to load the form directly rather from the dblclick on browse?

        Since this was my original code, I felt compelled to upade it to answer this thread. Not to displace Andrews contribution, but to add a little different approach and less verbose code to get the form open filtered. You will have to replace the form name (mine is f_customers) with your form name (maybe it's customer) and form table (mine is customer) and the customer unique ID.
        Code:
        FUNCTION two_param_lookup AS C ( )
        	
        dim global vproceed as C="yes"
        
        dim vL_names as C
        dim vL_rs as C
        dim vL_nocarat as C
        dim vL_show as C=""
        vL_names=table.external_record_content_get("customer","lastname+'^^'+firstname+'^^'+phone+'^^'+customer_i","lastname","")
        for each foo in vL_names
        	vL_rs=vL_rs+remspecial(word(foo,1,"^^")+word(foo,2,"^^")+word(foo,3,"^^")+word(foo,4,"^^"))+crlf()
        	vL_nocarat=vL_nocarat+word(foo,1,"^^")+word(foo,2,"^^")+word(foo,3,"^^")+crlf()
        	vL_show=vL_nocarat
        next
        
        dim vfind_ln as C
        dim vfind_fn as C
        dim vpick as C=""
        dim vR as C
        dim vctrl_fn as C="[.30vfind_l!evln_*]"
        dim vctrl_ln as C="[.30vfind_f!evfn_*]"
        
        vR=ui_dlg_box("Customer",<<%dlg%
        {font=courier,10}
        {lf};
        Search Name:;
        LAST NAME:[.30vfind_ln!evln_*];
        FIRST NAME:[.30vfind_fn!evfn_*];
        {lf};
        [.90,10vpick^#vL_show];
        {lf};
        Pick:;
        [.50vpick!evp_*];
        {lf};
        {line=1,0}
        {lf};
        <15OK> <15Cancel>
        %dlg%,<<%code%
        
        
        'field event
        IF left(a_dlg_button,5)="evln_"
        	if a_dlg_button="evln_change"
        		vpick=""
        		vL_show=filter_string_smatch(vL_nocarat,vfind_ln+"*",crlf())
        	end if
        	a_dlg_button=""
        END IF
        
        IF left(a_dlg_button,5)="evfn_"
        	if a_dlg_button="evfn_change"
        		vpick=""
        		vL_show=filter_string_smatch(vL_nocarat,vfind_ln+"* "+vfind_fn+"*",crlf())
        	end if
           a_dlg_button=""
        END IF
        %code%)
        
        'dialog closed
        	if vR="cancel"
        		vproceed="no"
        		end 
        	end if
        	
        'get the customer ID number using the phone number as filter of list
        	'combine all elements to a single string
        	dim vrsk as C
        	vrsk=remspecial(vpick)
        	'msgbox(vrsk,vL_rs)
        	
        	'get the last 8 characters which is the customer ID
        	dim shared vCID as C
        	vCID=right(filter_string_smatch(vL_rs,"*"+vrsk+"*",crlf()),8)
        
        ' Open the form	
        	if is_object("[COLOR="#FF0000"]f_customers[/COLOR]")
        		:[COLOR="#FF0000"]f_customers[/COLOR].activate()
        	else
        		:form.view("[COLOR="#FF0000"]f_customers[/COLOR]")
        	end if
        
        'filter the form
        	dim vfilter as C="[COLOR="#FF0000"]customer_i[/COLOR]="+quote(vcid)
        	:f_customers:tables:[COLOR="#FF0000"]customer[/COLOR].filter_expression = vfilter
        	:f_customers:tables:[COLOR="#FF0000"]customer[/COLOR].order_expression = ""
        	:f_customers:tables:[COLOR="#FF0000"]customer[/COLOR].query()
        
        END FUNCTION
        two_param_lookup()
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment

        Working...
        X