NetTalk Central

Author Topic: View child and grandchild tables  (Read 2556 times)

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
View child and grandchild tables
« on: July 10, 2012, 09:16:26 AM »
All table browses have "Insert/Change/Delete" turned off, but the "View" option is turned ON.  Child tables are accessed via parent table's UpdateForm.  I see the "View" button only on the main parent browse, but not on any child or grandchild browses?  What am I missing?

Thanks,
Sukhendu

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: View child and grandchild tables
« Reply #1 on: July 10, 2012, 11:54:27 PM »
can you maybe post a small example of the effect please Sukhendu.

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: View child and grandchild tables
« Reply #2 on: July 11, 2012, 07:04:10 AM »
Thank you Bruce.  It is a fairly large multi-dll app.  I'll create a small app and see if I can recreate the issue I'm facing and post it here.

Regards,
Sukhendu

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: View child and grandchild tables
« Reply #3 on: July 11, 2012, 10:16:33 AM »
Bruce,

Attached zip file has app,dct,exe, and tps files.  Things to look for are:

1) Browse/OrdInfo/View/OQRange Tab/ this where I'm looking for a View button to view OQRange data.

2) Clients file has data but does not show in Browse/Clients

Thanks,
Sukhendu


[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: View child and grandchild tables
« Reply #4 on: July 11, 2012, 09:14:56 PM »
Hi Sukhendu,
Thanks for the example.

a) obviously the View Button needs to be turned on in the BrowseOQRange procedure (Form Tab / View Tab) but I suspect you'd just turned that off for testing.

b) I found the bug which was preventing the button from being displayed, and that'll be sorted in the next build (6.38). In case you're interested it's a simple tweak, so you can adjust your netweb.tpw file there if you like. Search for the lines;
          If Loc:IsChange = 0 and loc:popup = 0
            packet = clip(packet) & p_web.CreateStdBrowseButton(Net:Web:ViewButton,'%procedure',,,loc:FormPopup,'%nFormControl')
          end
and remove the loc:popup test - ie changing the line to;
          If Loc:IsChange = 0

Cheers
Bruce

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: View child and grandchild tables
« Reply #5 on: July 12, 2012, 07:20:49 AM »
Hi Bruce,

That tweak did it.  Now I can see the "View" button.  Thanks. 

About the second point, the clients browse does not show any record while there are records in clients table (Browse Clients button on the net talk web server window where you see the logs).

Regards,
Sukhendu

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: View child and grandchild tables
« Reply #6 on: July 13, 2012, 12:01:34 AM »
>> 2) Clients file has data but does not show in Browse/Clients

this was an interesting one. First the root cause;

You had the XRefNo column ticked as the default sort column. And you have a key on
K_CLIXRefNo              KEY(Cli:CLIXRefNo),DUP,NOCASE,OPT

The key here being the OPT attribute - more commonly known as "exclude nulls".
And cunningly, in your data set, none of the records had any actual data in this column.

So the TPS View engine found a matching key (which is good) and then didn't find any records in the key, and hence didn't display any data.

Now "Exclude Nulls" is falling out of favor generally because it has no direct counterpart in SQL. In SQL you either have an index or not, and the idea of "index these fields, but only if data exists" simply doesn't feature. It's a very big deal when the key is also marked as "unique" (which yours isn't). In SQL creating a key on a field basically saying "this is unique if not blank" is equally perplexing.

So on to solutions;

a) in this case it's obvious - make the key not "exclude nulls". It's not a unique key, so that won't cause any issues.

b) Try and avoid creating keys with "exclude nulls" - even if that is the dictionary default. this will stand you in good stead in the long run.

Cheers
Bruce