NetTalk Central

Author Topic: How to do UnTag All from Button  (Read 3095 times)

Jim

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
How to do UnTag All from Button
« on: March 25, 2013, 08:38:00 AM »
I am using InMem driver as table to store my tags.  I duplicated the Tagging example -- except for the sessionID (changed it from LONG to STRING).  I have a few questions:

1. I set the Tag:SessionID field to STRING 256 -- is that correct?

2. I have the tagging browse on a Memory Form and would like to clear the tags with a button.  If I use the following code -- where should it be embedded under that button?

  TAG:SessionId = p_web:SessionID
  Loop until Access:Tagged.Next()
    If TAG:SessionId <> p_web:SessionID then break.
    Access:Tagged.DeleteRecord(false)
  End

3. Will this cause the browse to be refreshed automatically or do I need to handle that myself?

Sorry for all the questions...really trying to get a handle on this.

Thank you.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: How to do UnTag All from Button
« Reply #1 on: March 25, 2013, 08:43:43 PM »
>> 1. I set the Tag:SessionID field to STRING 256 -- is that correct?
yes. Thanks for pointing this out - I've tweaked the example for the next build.

>> 2. I have the tagging browse on a Memory Form and would like to clear the tags with a button.  If I use the following code -- where should it be embedded under that button?

So, as long as the button is of type "button" (not submit) and as long as it doesn't have a URL, then server code will run when it is pressed. This code goes in the validate::fieldname routine (where fieldname is the use equate you've assigned to the button.)

BTW - Your code needs a SET command right before the start of the loop. Also you're assuming the file is open, it's probably not, so you need to manually open and close it.

>> 3. Will this cause the browse to be refreshed automatically or do I need to handle that myself?

it depends a bit on context. I presume the browse is "on" the memory form along with the button? If so then you can refresh the browse by adding the browse to the RESET LIST of the button (on the client-side tab of the button).

cheers
Bruce



Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: How to do UnTag All from Button
« Reply #2 on: March 26, 2013, 04:21:07 AM »
Thanks Bruce. 

You might want to add a Set to the demo code as well.  That's where I lifted that from.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: How to do UnTag All from Button
« Reply #3 on: March 26, 2013, 09:47:10 PM »
Hi Jim,

As far as I can see the example only uses FETCH commands (which take the key as a parameter).
You've changed it to a NEXT command, which doesn't take a key, and needs a SET to be added before.

cheers
Bruce

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: How to do UnTag All from Button
« Reply #4 on: March 27, 2013, 04:18:47 AM »
Got it.  Thanks.  It's working now so I'm happy.