NetTalk Central

Author Topic: Which embed to capture the id of selected row in a browse?  (Read 4754 times)

Gregg Matteson

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Custom Program Solutions
Which embed to capture the id of selected row in a browse?
« on: July 16, 2007, 12:20:16 PM »
I've added my own Mailto: using the html tab in a browse so that I can fill in :
to:
subject:
and the body:
I'm trying to put the invoice ID ( unique ) in the subject and used
subject=<!-- Net:V:invid --> , where invid is set by
p_webSetValue('INVID',inv:id) in the embed - Override Javascript when a row is clicked. this yields the last ID of the browse rather than the correct one.

Is this currently possible?

Thank you for your time.

Gregg Matteson
Kindest Regards,

Gregg Matteson

'Software that's actually easy to use'

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: Which embed to capture the id of selected row in a browse?
« Reply #1 on: July 16, 2007, 10:42:36 PM »
Hi Greg,

This approach isn't going to work, because the tags are only evaluated outside the browse loop, so in effect they will all get resolved to a single value, which is the last one you set it to.

So what you'll need to do (since you're inside the loop) is use the actual file fields.  For example;
... subject=' & clip(inv:id) & ' ...whatever

Cheers
Bruce

Gregg Matteson

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Custom Program Solutions
Re: Which embed to capture the id of selected row in a browse?
« Reply #2 on: July 17, 2007, 04:24:12 AM »
Bruce,

tried your suggestion several different ways and it doesn't work . the template resolves it to a literal in the Mailto .

Tried my approach in the update form that feeds this browse and the <!-- Net:V ... syntax resolves to the id # .

2 things I can either leave the thing in the update form OR figure out the simplest way to make the SendMail function hadle this. I don't want to use the EmailFormControl , I want the info filled from fields in the browse .

Suggestions ?

Regards,


Gregg
Kindest Regards,

Gregg Matteson

'Software that's actually easy to use'

Rhys Daniell

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Which embed to capture the id of selected row in a browse?
« Reply #3 on: August 07, 2007, 11:43:55 PM »
I've ploughed through all the docs, examples, and postings I can find and read the above 15x and I still don't get it. Sorry.

I have a browse/form and view in the browse has two tables.

I want to capture a field value for the *non primary* table in the view when the user presses the Update button.

Is there an embed point somewhere which will give me this value for the highlighted record?

If it's the "Override JavasScript when a row is clicked" embed point, how do I determine whether it's the highlighted record?

TIA
Rhys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: Which embed to capture the id of selected row in a browse?
« Reply #4 on: August 08, 2007, 07:08:33 AM »
Hi Rhys,

this is a subtle variation on the usual form of this question. What you need is a row identifier, where the "unique id" is no longer unique (because of the child records).

This is not trivial, so I'll need to think about it. I'll try and come up with something you can use within the next couple of days.

Cheers
Bruce
 

Rhys Daniell

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Which embed to capture the id of selected row in a browse?
« Reply #5 on: August 08, 2007, 03:13:17 PM »
Bruce,

Ideally there would be a more generic solution e.g. an option to refetch the current view record (and an embed to do something with it) whenever a button is pressed on a browse page would be really handy.

An easier alternative might be to do a FileToSessionQueue() whenever a button is pressed (I'm assuming that function stores the current record in the system queue). This would have to be called for each table in the file embed.

HTH
Rhys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: Which embed to capture the id of selected row in a browse?
« Reply #6 on: August 10, 2007, 06:40:56 AM »
>> Ideally there would be a more generic solution e.g. an option to refetch the current view record (and an embed to do something with it) whenever a button is pressed on a browse page would be really handy.

The key to this is the concept of "Current View Record". Remember the browse procedure runs when the page is _generated_ and then the thread terminates.

By the time the user clicks on the button (or row) in the browse, there simply isn't any View active. Using the unique ID, you can reload the primary  table record.

Clearly though, this isn't good enough. Rather than passing the primary table unique id, we need to sore, and pass back, the view "position".

Alas that's not a completely trivial change to make, but a necessary one. It will be interesting to see also how badly it breaks the existing code where folk are expecting back the ID, not the View position.

I'll make the change over soon - probably in 4.30 - I'm busy testing the 4.29 build now for release early next week.

Cheers
Bruce