NetTalk Central

Author Topic: Filtering browses  (Read 5098 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Filtering browses
« on: January 14, 2014, 11:40:49 AM »
Bruce,

     I'm struggling with filters again.  I have a memory form with multiple tabs on it.  Tab one has a patient browse.  Tab 2 has a related browse, that I would like to filter, based on the selected record in Tab 1.  On the browse in Tab 1, I have code in the "user selects row in browse" embed to set a session variable to the currently selected patient ID.  I have a message statement that shows this session variable is set correctly.  I set a filter on the browse in Tab 2 to use this session variable.  The filter is as follows:

     'MarPlc:Patient_ID = <39>'&p_web.GSV('PatientIDFilter')&'<39>'

Still, the browse in Tab 2 is not filtered.  I have missed something.  Can you help?

Thanks,

Jeff

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Filtering browses
« Reply #1 on: January 14, 2014, 02:18:41 PM »
Have you also set the browse in Tab 2 to refresh after a user clicks on a record in browse1?

Also what is the unique key field in Tab1? You may not have to use your embed code

eg    'MarPlc:Patient_ID = <39>'&p_web.GSV('Mar:Patient_ID')&'<39>'


kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Filtering browses
« Reply #2 on: January 14, 2014, 08:23:24 PM »
Kevin,

     Can you explain how to set the browse in Tab 2 to refresh?  Also, the Patient_ID involved is numeric.  It occurs to me that I do not need to use '<39>'.  So I tried the following:

      'MarPlc:Patient_ID = p_web.GSV('Enc:Patient_ID')'

but it still does not work. 

     Perhaps it is my set up.  I have a file called PatientEncounter.tps and one called Marker.tps.  The PatientEncounter file has a primary key defined using the field Patient_ID (unique, primary, autinc).  The Marker file also has a key defined on Patient_ID, and a relationship set up to PatientEncounter using the Patient_ID key. 
     Tab one has the browse for the PatientEncounter file.  Tab 2 has the browse for the Marker file.  I have also tried using a range, both with the relationship and a single value settings.  Still, when I move to tab 2, it always displays the last record in the marker file, regardless of which patient record I have selected in tab 1.

     Is there anything else you can think of?

Thanks,

Jeff

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Filtering browses
« Reply #3 on: January 15, 2014, 06:35:55 PM »
What I normally do is start with a memory form and then add my browses and any other controls like buttons etc. When you add the browse control go to the client-side tab. This is where you can add your other browses (you need to add them to the form first).

try filter  'MarPlc:Patient_ID = ' & p_web.GSV('Enc:Patient_ID')

There is also a template option to send the filter to debug view if it is still giving you grief.

It doesn't matter about keys and relationships.

There is also an option on the browse template to add child browses. This takes care of all the refreshing but you still need to set the filter. If you have complicated browses then you need to do it manually.

HTH's

Kevin


kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Filtering browses
« Reply #4 on: January 16, 2014, 11:40:21 AM »
Kevin,

     Thanks, that helped, along with a session with Bruce this morning on ClarionLIve.  I'm getting closer.  The browse on tab 2 is now filtered but always defaults to filtered for the first record in the tab 1 browse.  For example, the browse on tab 1 shows two patient records, one with patient_id =2 and the other patient_id=1, in that order.  When I first open this app, the first browse row is selected, the one with patient_id =2.  Moving to tab 2 shows the record for patient_id 2.  Now, when I select the other record in the browse on tab 1, for the patient_id=1, and move to the second tab, it is still filtered for patient_id=2.  It seems simply selecting the other record does not update the filter.
     I used debugview to trace the actual filter and it shows:  MarPlc:Patient_ID = 2.  I only get this upon first opening the app.  The filter does not get updated after that.  However, if I open a record on the browse on tab 1, then go to tab two, the filter is updated as expected.
     So, I'm at the point where I need to get the filter to change as I select each record in the browse on tab 1 (the "parent" browse).  Any ideas on how to do this?

Thanks,

Jeff

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Filtering browses
« Reply #5 on: January 16, 2014, 05:39:19 PM »
Can you upload a screenshot of Browse1 client side tab (where you set the refresh of bowse2)?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11242
    • View Profile
Re: Filtering browses
« Reply #6 on: January 17, 2014, 02:09:15 AM »
hi Jeff,

I believe there is a bug in the system currently when opening a form with these cascading browses. It's on my list.

cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Filtering browses
« Reply #7 on: January 17, 2014, 09:19:54 AM »
Kevin,

     I have attached the image you requested...

Jeff

[attachment deleted by admin]

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Filtering browses
« Reply #8 on: January 17, 2014, 11:12:25 AM »
Bruce,

     Is there a time estimate...perhaps in the next release?  Otherwise, can you think of a workaround?  The main idea is that the user must select a patient, then have the other browses filtered for that patient.  Child browses, next to the parent browse won't work here since there are multiple browses that won't fit to the right or below the parent.
     My thought is a sub-menu, perhaps to the right of the parent browse.  But I have no idea how to get that effect.

Thanks,

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Filtering browses
« Reply #9 on: January 17, 2014, 01:57:00 PM »
Bruce and Kevin,

     I have actually been successful in a work-around.  I created a second menu procedure and call it along with the Patient Enrollment browse on tab 1.  I removed all other tabs.  I now have a menu to the right of the browse and it calls the related browses properly filtered.  In fact, I like this design better than the one with multiple tabs.  But, there is still one issue.  I have a ghost menu showing in the lower left corner.  Please see the green arrow in the attached image.  I can't seem to get rid of this.  Any thoughts?

Thanks,

Jeff

[attachment deleted by admin]

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Filtering browses - Solved
« Reply #10 on: January 18, 2014, 09:10:46 AM »
Turns out the solution was very easy...just add the second menu procedure as a child of the browse.  Works great!

Jeff

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Filtering browses
« Reply #11 on: January 18, 2014, 11:55:23 PM »
Great. BTW you could also make your menu items buttons and the form or browse.