NetTalk Central

Author Topic: Custom Button on browse  (Read 6245 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Custom Button on browse
« on: August 30, 2012, 08:15:55 PM »
Bruce,

     In another post I asked about converting an old frame based app to NT 6.41.  I decided to try and import old procedures into a newly built app.  One of the procedures is an Insight Graph.  I would like to call this from a custom button on the browse, basically a "Graph" button in line with the others.  I see from an older post that this is not a trivial thing to do and requires coding.  Can you elaborate on this?  Or perhaps there is another way?
     One thing I have tried is to use XHTLM to put the graph on the same page as the browse.  I have it currently under the browse and buttons by calling the graph procedure after the div tag.  How can I get this to display to the right of the browse?  I suspect I may need to use XHTML to caode a table but thought I would ask if there was a better way.
     One final note, the graph does not display data even though it is configured as it was in the old app.  Is there a way to force a "reset" or something to get the data to display upon opening the browse page?

Thanks,

Jeff King

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11310
    • View Profile
Re: Custom Button on browse
« Reply #1 on: August 30, 2012, 10:06:56 PM »
I would do it like this;

a) create a netWebSource procedure, which calls the graph procedure. Note that the "currently highlighted browse record" will be in the Session Value of the Id field. So your graph should always use the SessionId as the starting point of the filter.

b) make the netWebSource a "child" of the browse (on the children tab.)

I haven't tried this layout recently myself, but it should work.


kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Custom Button on browse
« Reply #2 on: August 31, 2012, 06:54:56 PM »
Bruce,

     I tried this and the graph (DrainageGraph) does appear on the same page as the browse.  The netWebSource procedure is called CallDrainageGraph.  In it I set a procedure call to DrainageGraph in the XHTML tab.  When the window fist opens the graph is under the buttons.  I found that if I expand the window, then the graph will appear to the right of the browse.  Not a big deal.  However, I still cannot get data to display on the graph.
     I have two files, one Surgery.tps and a child file Drainage.tps.  The related field in each is Sx_ID.  In the older frame-based app I have the filter on the graph set to Dra:Sx_ID = Sur:Sx_ID.  This works fine in the older app but not in this new app.  So, as you suggested, I tried building the filter with the session values of these variables but still no luck.  Can you suggest where I might have gone wrong?  I have attached the app and dct files should you or others have some time to take a look.

Thanks,

Jeff

[attachment deleted by admin]
« Last Edit: August 31, 2012, 08:10:13 PM by kingja »

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Custom Button on browse
« Reply #3 on: September 01, 2012, 07:38:48 AM »
Bruce,

I found that if I  remove my current filter, then all data does appear in the graph.  Thus the problem seems to be with the filter.  I have tried dra:sx_id = p_web.gsv('sur:sx_id') and others in the filter for the graph.  In the old frame-based app the filter that worked was simply dra:sx_id = sur:sx_id.  I'm still trying other ideas.  Any thoughts?

Thanks,

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Custom Button on browse
« Reply #4 on: September 01, 2012, 05:05:58 PM »
     I have a working solution.  I created a global variable called glo:Sx_ID.  It is set to the 'sur:Sx_ID' session value when a user selects an item in the surgery browse.  Then on the graph I set the filter to dra:Sx_ID = glo:Sx_ID.

     I tried using many combinations of session variables with getsessionvalue etc., but these don't seem to work on the graph filter in my case.

Thanks,
Jeff

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Custom Button on browse
« Reply #5 on: September 02, 2012, 03:45:31 PM »
Globals are a no no in web apps if the value can be changed. I would say your filter using a gsv was not formed correctly. Use debugview and on the template tick send filter and order to debug view.

You will probably find you filter needs to be something like this if it is numbers:

'dra:Sx_ID = ' & p_web.gsv('sur:Sx_ID') !glo:Sx_ID

or this if the ID contains alpha numeric

'dra:Sx_ID = <39>' & p_web.gsv('sur:Sx_ID') & '<39>'

looking at the value of the filter via debug view normally helps...

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Custom Button on browse
« Reply #6 on: September 02, 2012, 07:45:14 PM »
Kevin,

     Thanks!  I'll give this a try and follow up here.

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Custom Button on browse
« Reply #7 on: September 03, 2012, 07:53:37 AM »
Kevin,

     I tried your suggestion but still not working.  I'll look into the docs to learn how to use debugview.

Thanks,

Jeff