NetTalk Central

Author Topic: records in filtered browse  (Read 4389 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
records in filtered browse
« on: February 05, 2015, 12:10:26 PM »
Bruce,

I have a form with one tab page on it.  This tab page has two fields, each field calls a procedure.  Procedure 1 is a filtered browse.  Procedure 2 is a form.  This second form has buttons and is essentially a side menu.  See the attached image.

I would like the second form (the side menu) to only appear if the browse contains one or more filtered records.  I have experimented with loc:found thinking this would be zero if the browse was empty.  I have not been able to get this working.  Can you suggest a way to accomplish this?

Thanks,

Jeff

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: records in filtered browse
« Reply #1 on: February 08, 2015, 10:03:00 PM »
an example would be helpful Jeff. There are a couple approaches you could take - specifically having the one field (ie the browse) reset the other (the form). But I'm not 100% sure what the events will look like using your construction.
(I suspect a better construction would be to simply use a single form, not the "form inside a form" approach.)
Using a single form would clear up your other problem as well.

cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: records in filtered browse
« Reply #2 on: February 09, 2015, 01:18:02 PM »
Bruce,

Thanks!  Using one form, with a browse and the makeshift side-menu has worked.  Now the menu to the right stays put.

My next chore is to not display these menu buttons to the right if there are no records in the browse.  I have set a total on the first column of the browse.  My thought was that if this is zero (0) then I would set a session variable called 'EmptyBrowse' to 'Yes'.  I do this in the After Browse, Before buttons embed as recommended by you in another NT Central post.  My code here is:

If Loc:Total[1] = 0
   p_web.SSV('EmptyBrowse', 'Yes')
Else
    p_web.SSV('EmptyBrowse', 'No')
END

Then in the "hide" template entry for the buttons, I place p_web.GSV('EmptyBrowse') = 'Yes'

This does not work, I have tried many different embeds.  I suspect a timing issue, where the Loc:Total
  • variable is not set before the menu buttons are created and displayed.  Any thoughts?


Thanks,

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: records in filtered browse, more info
« Reply #3 on: February 09, 2015, 06:40:24 PM »
Bruce,

In looking at the source, I found that the loc:Total variable created was Loc:Total[24].  I expected that since the Study_ID column I'm totaling is column one, that it would be Loc:Total[1].  Can you help me understand this?

Also, I have included an image of my source, Totals.png.  It shows that I added code just after the total is calculated in the browse...I think that is what this shows.  Still, I don't get the button to dynamically display based on the total.  See image Menu.png.  There should be a Reflector Placement button above the Reflector Location button.

Any other thoughts?

Jeff

[attachment deleted by admin]
« Last Edit: February 09, 2015, 06:42:50 PM by kingja »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: records in filtered browse
« Reply #4 on: February 09, 2015, 08:42:18 PM »
>> In looking at the source, I found that the loc:Total variable created was Loc:Total[24].  I expected that since the Study_ID column I'm totaling is column one, that it would be Loc:Total[1].  Can you help me understand this?

It doesn't use the position as the index into the array. Rather it is using the internal ID for that column. In this case this was the 24th column added to the browse - the fact that it is displayed first is irrelevant.

that said, your totals appraoch is unnecessary. And probably wrong because if there are no rows it's never going to have a value to display, and hence will never get to that code.

In a browse there's a local variable (loc:found) set if there are records in the browse. So I'd suggest adding code to the end of the BrowseTable routine which tests loc:found and sets a session value there to an appropriate value.

cheers
Bruce



kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: records in filtered browse
« Reply #5 on: February 10, 2015, 12:23:58 PM »
Bruce,

     Thanks!  the loc:found variable was just what I needed.

Jeff