NetTalk Central

Author Topic: Conditional display of child browse based on indicator in parent  (Read 4336 times)

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Conditional display of child browse based on indicator in parent
« on: December 06, 2012, 01:34:13 AM »
NT5.52
I have a parent browse which has a checkbox field WAYC:ChargeByRoll. I have 2 child browses WayRoll and WayRate
I have added them both to the parent browse to appear on the right but I want the Wayroll browse to appear if the  WAYC:ChargeByRoll is true or the Wayrate browse to show if the  WAYC:ChargeByRoll is false
In the wayRate Browse under conditional filters if have set up the range by file relationship which works. I can either specify a condition or a child of procedure setting but not both
In the condition field  I have tried
'WAYC:ChargeByRoll = 0'
WAYC:ChargeByRoll = 0
p_web.GSV('WAYC:ChargeByRoll') = 0

All of which display the heading of the WayRate browse
Can anyone point me to the correct syntax to only display one or the other of the child browses.

many Thanks
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Conditional display of child browse based on indicator in parent
« Reply #1 on: December 08, 2012, 02:18:13 AM »
Just a poke to see if anyone has got an idea, or if its not possible.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Conditional display of child browse based on indicator in parent
« Reply #2 on: December 09, 2012, 10:08:19 PM »
Hi Terry,

I think a couple of items probably contribute to the lack of responses (not just from me, but from everyone.)

a) it's an old build, so fewer folk are using it, and for those of us who did use it, it's hard to remember specifics, especially about a complex setup like the one you are suggesting.

b) you're describing quite a complex layout, and you need very specific information. In order to answer effectively the answerer would need to build a small example to duplicate your setup, hope they got it right, and then hopefully answer what you are asking. If on the other hand you posted a small example app it would be easy to open it up, follow your instructions on where to go, and perhaps experiment with possible solutions.

cheers
Bruce


terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Conditional display of child browse based on indicator in parent
« Reply #3 on: December 09, 2012, 11:12:27 PM »
Sorry
I thought it was quite simple and that there would be no difference between NT5 and NT6.
All I was trying to find out was how to hide a child browse based on a setting value in the parent table. I'll try to set up a small example.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Conditional display of child browse based on indicator in parent
« Reply #4 on: December 10, 2012, 02:13:30 AM »
OK using NT6
I modified example1 (files attached).
I added a field to the mailbox called child1only
If you run the application you will see I have it checked on the terry mailbox
Want I want to do is only display the child1 browse when this field is checked and only display the child2 browse when the field is unchecked.


[attachment deleted by admin]
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Conditional display of child browse based on indicator in parent
« Reply #5 on: December 10, 2012, 10:55:06 PM »
>> I thought it was quite simple

I know what you mean, but actually it's not. Let's frame the question slightly differently to highlight some of the complexity;

a) the parent browse has two children.
b) depending on which row is clicked or selected
c) hide or unhide each child.

both children are always there - they have to be else you would not be able to refresh them.

also you are refreshing on some unrelated field to the primary key of the row selected. (ie clicking on a row does not load that record, so you need to load the record yourself.)

To make things slightly more complicated the children are potentially visible in two distinct cases. First, they are (possibly) visible when the parent is first displayed, and then their visibility may change on each row click.

The first question is where to "control" this behaviour. One place would be the parent browse, but I think it would be better in the child browse. ie rather than the parent telling the child, the child is aware of the conditions under which it should be visible or hidden. So I recommend working in the child browse procedure.

To keep it simple you basically need the following behavior at the top of the CallBrowse routine;

a) loc:parent contains the parent browse name, so wrap your code in a test of this.
a) load the parent record based on the Session Value of the parent ID field. This way you have the related field you need.
b) set loc:parentsilent based on what you read. (1 = hidden, 0 = not hidden).

cheers
Bruce


loc:parentsilent is a mechanism used to make the child invisible (and if you added code to the parent, you'd effectively be setting this).

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Conditional display of child browse based on indicator in parent
« Reply #6 on: December 12, 2012, 12:11:15 AM »
Thanks Bruce. That works perfectly. If anybody is interested in the above example working with these changes put a comment here and i will post it.

OTT rant. I wish Clarion8 wouldn't move code lines into column 1 even though I have indented the line, specifically in places ( e.g. the embed you mention) and then give cryptic error messages relating to the line starting in column1
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186