Alpha Video Training
Results 1 to 8 of 8

Thread: Opening a second form and displaying selected records shown in the first form

  1. #1
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,318

    Default Opening a second form and displaying selected records shown in the first form

    Not had this trouble before.
    I have a master form which captures data. Lots of it.

    To simplify viewing of key fields, I have a Quick Filter button which clearly shows the number of records in the sub-set.
    The second form shows fewer fields and the setting is to display only the Selected Records from the first form.

    Most time this works and the correct number of records are shown however occasionally the number of records selected reverts to the whole data set and shows record number 1.
    This mightily confuses the users.

    Question. How to force the presentation of the Selected Record from form 1 in form 2 consistently?
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  2. #2
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,581

    Default Re: Opening a second form and displaying selected records shown in the first form

    Action Scripting allows you to open another form and match records based on a field value.

    It's a good place to start and view the code generated.
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  3. #3
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,318

    Default Re: Opening a second form and displaying selected records shown in the first form

    Not what I want Al.
    I need the currently selected records to display in the new form on display.
    Action scripting code does not seem to work consistently.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,632

    Default Re: Opening a second form and displaying selected records shown in the first form

    A screen shot would be helpful...and a bit more info wouldn't hurt either.

    If the table is the same, try a saved Query operation if your filter is more complex than what Al suggested. Otherwise, if the AS does work most tmes, then post the xbasic from it and we can help you modify it.
    Last edited by MoGrace; 12-20-2018 at 04:27 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,581

    Default Re: Opening a second form and displaying selected records shown in the first form

    Quote Originally Posted by Ted Giles View Post
    Not what I want Al.
    I need the currently selected records to display in the new form on display.
    Action scripting code does not seem to work consistently.
    I'm thinking there are deep dark secrets that can be answered with a sample....

    That's the best I can do for humour today..
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  6. #6
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,318

    Default Re: Opening a second form and displaying selected records shown in the first form

    Thanks both, I will put something together.
    What I have noticed, is that if I edit form 1 and save it, the problem persists. Compacting the workspace allows the app to work properly.
    I have tried reindexing but that didn't help.
    Anyway, I will attempt to post an example.

    Edit. Robins comment triggered sumething in my aging brain. I will try using the Action Script code as a code snippet and try that in my OnPush event. It might just be the interaction of multiple events on the form confusing the action script.
    I will post it anyway.
    Last edited by Ted Giles; 12-20-2018 at 05:47 PM.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  7. #7
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,318

    Default Re: Opening a second form and displaying selected records shown in the first form

    Code used as an Action Script.

    Code:
    'Quick Filter
    
    'Filter records based on the value in current control in current form.
    'If the current object is a button, then first give focus to the previous object
    If obj(topparent.active()).class() = "button" then 
    	obj(topparent.active_prev()).activate()
    End If
    topparent.quick_search()
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    
    'Refresh - not sure if it is actually required
    
    'This action has been commented out.
    ' 'Refresh data in current form at parent level.
    ' 'Can only resynch data in View mode, so save record first to be sure that layout is in View mode.
    ' topparent.Commit()
    ' topparent.Resynch()
    ' topparent.Refresh_Layout()
    
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    'Open new form with current filter active
    
    'Open a Form or Browse layout, displaying all, or selected records in the layout.
    current_filter = current_filter_expn()
    current_order = current_order_expn()
    query.filter = current_filter
    query.order =  current_order	
    
    
    'Open the layout_type showing just the records that satisfy the filter
    DIM Shared varP_My_Test_Form as P
    DIM layout_name as c 
    layout_name = "My Test Form"
    
    
    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_My_Test_Form = :Form.viewqueried(layout_name,query.filter, query.order )
    
    	end if
    else 
    	varP_My_Test_Form = :Form.viewqueried(layout_name,query.filter, query.order )
    
    end if
    Last edited by Al Buchholz; 12-20-2018 at 06:16 PM. Reason: added code tags
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  8. #8
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,318

    Default Re: Opening a second form and displaying selected records shown in the first form

    Oh well!
    I cannot regularly replicate the problem I was/am having, and the app is a confidential client one which I really cannot post as an example.
    I will just have to wait and see how many problems I get and maybe do a rewrite for the record selection process.
    FBF works with no error at all! It's the QF which is the issue.

    Thanks for listening.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

Similar Threads

  1. Copy selected child records from one form to another form
    By adamry in forum Alpha Five Version 10 - Desktop Applications
    Replies: 5
    Last Post: 07-01-2010, 10:08 AM
  2. Replies: 5
    Last Post: 05-20-2006, 06:01 PM
  3. Re:Opening form from selected browser
    By Robert Rough in forum Alpha Five Version 5
    Replies: 4
    Last Post: 09-10-2004, 12:37 PM
  4. Opening form from selected recorded on browser.
    By rlgiordano in forum Alpha Five Version 5
    Replies: 17
    Last Post: 09-10-2004, 11:29 AM
  5. Child records shown as form - Not browse
    By Robert Rough in forum Alpha Five Version 5
    Replies: 8
    Last Post: 09-09-2004, 02:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •