NetTalk Central

Author Topic: Tag All Records  (Read 4027 times)

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Tag All Records
« on: October 28, 2013, 12:44:16 PM »
I have a select record browse at the moment which I can select the records that I want processing. But now I want to add a checkbox to the browse header, so that if ticked all records are ticked and  processed. Please how do I achieve this.

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Tag All Records
« Reply #1 on: October 28, 2013, 03:06:56 PM »
Do you want to select all the records you can see on screen or all in the table and what if the browse is filtered with your own filter or a search filter the user types?

You need to either just loop through the Table or View as you would in a normal app and add the id to the tagged table and then refresh the browse to show the tagged records.

Hope this gets you started in the right direction.


Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Tag All Records
« Reply #2 on: October 28, 2013, 05:43:37 PM »
Hi Olu,

Not sure about putting a checkbox into the header itself (you could custom code I'm sure, somehow).

But you can just wrap the browse in a memory form, and then put a checkbox above the browse. That's how I achieve this kind of thing.
Cheers,

Stu Andrews

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Tag All Records
« Reply #3 on: October 29, 2013, 02:57:37 AM »
Hi Olu,

Its a bit fiddly, and not playing ball with NT, my first suggestion is just do it with a button, that will be easy, but if you wanna play hard ball here is the outline:

You need to create the Header yourself.

The header will need an icon its just a image, well actually its either an unchecked image or a checked image. This isn't a normal NT field, since you are sticking it in a header. So you'll need a session variable to remember if its ticked or unticked. You'll need to chose the correct image based on the session value.

MyOnClick = 'sv('''',''myPage_myPageParent'','''',''_refresh_=current'',''action=toggleTag'','''',''_parentproc_=myPageParent'');'
MyCrazyHeader = '<div onClick="'&CLIP(MyOnClick)&'"><img src="'&CHOOSE(p_web.GSV('TaggedOrNot')='','unchecked.png','checked.png')&'" /></div>'

MyCrazyHeader is the field you will use for the Header, you'll need to check XHTML and unsafe XHTML for the header.

If your page has a parent page then you'll need the above syntax, if not try this:

MyOnClick = 'sv('''',''myPage'','''',''_refresh_=current'',''action=toggleTag'','''','''');'

What this will do is call you page when the image is ticked, nothing else...

However you can check for the action in GetValue like below:

IF p_web.GetValue('action') = 'toggleTag'
  IF p_web.GSV('TaggedOrNot') = ''
    !currently not tagged
    !tag all my records here
    p_web.SSV(TaggedOrNot',1)
  ELSE
    !currently tagged
    !untag everything
    p_web.SSV(TaggedOrNot',1)
  .
.


This needs to go into an embed point, probably top of GenerateBrowse or similar (needs to be pretty early on)

Thats the basic outline, probably errors in my code, but thats the basic idea.

I'm guessing that makes the Standard Button look pretty attractive now :)

Regards
Bill

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Tag All Records
« Reply #4 on: October 29, 2013, 07:31:57 AM »
Once upon a time there was code in the template to do this - but only for the page of records that were displayed.
I'm not sure if it still works though - it was always "hidden" from general view.

Are you wanting to tag the whole page, or all the records you can't see as well?

cheers
Bruce

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Tag All Records
« Reply #5 on: October 30, 2013, 08:05:25 AM »
Hi Bruce,
    All records that I can't see as well.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Tag All Records
« Reply #6 on: October 30, 2013, 11:58:56 PM »
thank I think you'll want to put your browse on a form, and add a button to the form which tags all the records and refreshes the browse. That's the simplest approach.

cheers
Bruce