NetTalk Central

Author Topic: Lookups  (Read 4582 times)

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Lookups
« on: August 19, 2015, 06:43:04 PM »
Hi  (I have started a new topic on this because the other thread was getting long and I wanted to start again because things have changed and moved on)

I have discovered some very peculiar things after exhaustively investigating this problem.  Firstly a recap of the current situation:

I now have a running application which includes 3 separate forms and lookups on a Districts file.  Districts has two fields, Country and District.  This running application works perfectly as regards these lookups in two cases viz:

- standard browse form
- option where a form is opened in change mode (no browse)

The third case does not work all the time - form opens in insert mode.  Specifically what happens here is that I prime country with 'New Zealand'(and this appears correctly as a radio field on the opened form) but after popping up the Districts browse, seeing the correct districts for that country (I have a filter in the browse on current country, if upper(p_web.GSV('FND:Country')) not= upper(Dis:Country) then CYCLE.) and selecting a district, the value does not get displayed in the district field.

Now, if you change country, say to 'Australia', and lookup again, the correct new districts are displayed in the browse and selection causes the receiving field to be properly populated.  From then on you can go back to any country and get the right answer.  So, its only on the first time access of the loookup for this 'insert mode' case that the procedure fails.

Also, 'Building Applications with NetTalk' says that if the lookup browse is a popup (which mine is) then the only field that you can get back is the primary key field (in my case RecordId) and that a way around that, if you want to actually put the description back into the database field (i.e. non-normalised data) then add an assignment, in this case fnd:address4 = dis:name.  However, my testing seems to indicate that this is not necessary.  If you specify the Value field as dis:name and do not do the extra assignment then the district name is correctly stored. I would appreciate a comment on that - have things changed since the book was released?

Lastly, a weird thing happens when I change the option for the lookup browse from popup to not. The browse appears as before (but full screen) and after selection, the page is redisplayed but the user is logged out and only the login menu option is available!  This is either a bug or I have done something silly but either way I would like to know the answer just as a matter of interest.

My questions then are why does this 'insert mode' case not return the selected data to the field first time, is the 'Book' out of date and what about 'not popup'?

Thanks

Keith

 

Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Lookups
« Reply #1 on: August 20, 2015, 10:18:49 PM »
Hi Bruce

I think there could be a bug in NetTalk as regards placing a Lookup on a Form which is called in Insert mode with no Browse.

I was continuing development of my application and decided to place another lookup on a Form and when it didn't work I realised that it was another 'Insert Mode' form.  I then placed the same Lookup on a standard Form (Browse/Form) as a further test and it worked.

This means that I have 5 Forms with Lookups that are ok and two, both on 'Insert Mode' Forms, that don't.

I would appreciate your comment on the likelihood, this may be a red herring but it looks suspicious.

Thanks

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Lookups
« Reply #2 on: August 21, 2015, 12:17:23 AM »
Maybe you can construct a small example of this effect Keith?
Modifying one of the shipping examples is the best way.

cheers
Bruce

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Lookups
« Reply #3 on: August 24, 2015, 12:26:15 AM »
Hi

Is it actually the case that a Popup lookup can only return the Primary Key (as it says in 'Building NetTalk Applications') or has that been superseded?  In the past I have set the 'Value' field to a non-PK field (like a description) and it has worked.  Maybe this was serendipity - what is the rule?

Thanks

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Lookups
« Reply #4 on: August 24, 2015, 10:23:53 PM »
There is a "more assignments" section if you want to return fields other than the primary key. As I recall the only thing you can/should rely on is the primary key. Other fields may have a value in them, but they are not guaranteed.

cheers
Bruce