NetTalk Central

Author Topic: Extra Buttons in Browse Forms  (Read 1542 times)

DonnEdwards

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Insights and Rants
    • Email
Extra Buttons in Browse Forms
« on: May 30, 2021, 05:54:04 AM »
I have studied the code in the Buttons (28) example, but I'm still having problems.

Please take a look at the form I want to create (attached image)

1. Mark/unMark button

I want to be able to allow users to "mark" rows. The name of the person who mars the row is stored in the "selected_session" field. The heading is just "Selected" and instead of showing the name of the user, I show "Yes" if
AL1:selected_session = p_web.GSV('UserName')
If there is a different user name then I display "No".
If there is no user name I display "-"

If the column displays "Yes" then I want the text of the adjacent button to be "unMark", and if it is "-" then the text should be "Mark". At the moment I can't get this to work. Is there an equivalent of the Visual Basic IIF function in Clarion? I can't seem to find one.

Any suggestions would be most welcome.

2. Filter Display

I can't figure out how to display the value of a filter that is applied to the browse. An example would be "Category = 'Sales'" that I have drawn in to the image, but I have no idea how to put it there. Again, any suggestions would be most welcome.

3. Filter Button

Along with the filter display I would like a "Filter" button. in this case I want the user to be able to click it to show only the "marked" records I have in item 1.
AL1:selected_session = p_web.GSV('UserName')

I would like to be able to toggle the filter off again, so that all records can be displayed.

4. Mark Button operation

The Server Code for the Mark button is as follows:

  UD.Debug('This is the value of AL1:selected_session ' & AL1:selected_session)
  IF len(clip(AL1:selected_session)) <= 1
      AL1:selected_session =  p_web.GSV('UserName')
  ELSIF CLIP(AL1:selected_session) =  p_web.GSV('UserName')
      AL1:selected_session = ''
  END
  UD.Debug('This is the value of AL1:selected_session ' & AL1:selected_session)


I also have enabled the option to "Refresh browse row DATA after server code runs".

Each time the code runs, it gets the value of AL1:selected_session from the actual record, but after changing it, the record itself doesn't change, only the browse display. How do I update the record as well as the browse display?

Any suggestions, RTFM topics, etc will be greatly appreciated.
If you're happy with your security, then so are the bad guys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11175
    • View Profile
Re: Extra Buttons in Browse Forms
« Reply #1 on: May 31, 2021, 12:22:27 AM »
>> Is there an equivalent of the Visual Basic IIF function in Clarion?

I believe the equivalent is CHOOSE - assuming that IFF is an in-row IF statement. (I never used VB).

Also, for Marking you might want to inspect the Tagging(48) Example. Because browses are page loaded you need to be able to store tags for "undisplayed" records.

>> 2. Filter Display

Generally speaking, when you want to "add fields to a browse" (typically buttons, text etc) then you are talking about adding a browse control to a memory form. Because a memory form is a "container" of all kinds of field types, and it can contain a browse. So "adding to a browse" is "create a container with multiple different fields" - and the NetWebForm is that container.

Forms have drop-downs, Display, Entry fields and so on, so you can add what you like to the browse.

>> The Server Code for the Mark button is as follows:

cool. But that code just sets a local variable (which will be gone by the end of this thread a few hundredths of a second later.)
You don't really say what you want the code to do, so it's hard to comment more on that...

>> How do I update the record as well as the browse display?

If you want to update a table row on the disk, then
open the table
load the row
set whatever you want to set
save the row
close the table

the Tagging example shows this...

cheers
Bruce




DonnEdwards

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Insights and Rants
    • Email
Re: Extra Buttons in Browse Forms
« Reply #2 on: May 31, 2021, 08:12:51 AM »
Hi Bruce
Thanks for the advice and assistance. I wasn't thinking "web" when I wrote the tagging code I used. Thanks for the reminder. I had a few problems getting the Tagging example to work, but it has been a great help.
Best wishes
Donn
If you're happy with your security, then so are the bad guys