NetTalk Central

Author Topic: NT7.20 Change from Drop to string lookup problem  (Read 3848 times)

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
NT7.20 Change from Drop to string lookup problem
« on: August 30, 2013, 04:18:27 AM »
Hi Bruce

I have existing drop down fields, I change the Type to 'string' and select 'Lookup Button' on. I add the Lookup procedure with 'Display Description instead of Value' on.

When I select the item in the lookup browse, the string field stays empty. When I change the setting not to display description instead of value to off, the value of the value field display but NO description on the right hand side of the field.

I even delete the field compile and re-enter the field again, the same effect.

Any suggestions.
Regards
Johan

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: NT7.20 Change from Drop to string lookup problem
« Reply #1 on: August 30, 2013, 10:13:04 PM »
Johan,

Did you define the description field as a unique key?

Rene
Rene Simons
NT14.14

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
Re: NT7.20 Change from Drop to string lookup problem
« Reply #2 on: September 03, 2013, 12:20:15 AM »
Rene,

The value field is not on a unique key.

Many tanks

Johan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: NT7.20 Change from Drop to string lookup problem
« Reply #3 on: September 03, 2013, 07:13:27 AM »
to make use of display-description-instead-of-value the description needs to be in a unique key by itself.

cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: NT7.20 Change from Drop to string lookup problem
« Reply #4 on: September 03, 2013, 09:42:21 AM »
Thus if I have a unique integer record id key field on a table record which has 120 character description field and I wish to link this record to another record via the record id field selected by a user lookup.  You are saying that I will need a another unique key on the 120 character description field to the show the description instead of the record id of the selected record after the user has selected the record from the look-up procedure. That does not seem right! The user is not entering the description, nor is the description being saved in the related record. The generated code should just fetch the record via the record id key and show the description field. Where (and why) is the description field being used to fetch the record?

Rob
« Last Edit: September 03, 2013, 12:25:40 PM by Rob Kolanko »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: NT7.20 Change from Drop to string lookup problem
« Reply #5 on: September 03, 2013, 09:10:44 PM »
Hi Rob,

Because the description is being shown in the HTML Form field, it is the description, not the value, which is sent back to the server when the form is completed.
The server then loads the record (based on the description), gets the actual ID value, and then stores that away with the record being saved.

As a bonus, if you have "Display description instead of value" turned on, then the user can enter the description, or the value, into the field, and it'll "just work". Plus of course, auto-complete can then be turned on for the field as well.

The description key is useful elsewhere because it's probable that the user will want to sort that browse by the description in many cases. So having that key is good for the VIEW engine as well.

It's ok not to have a description field, but then unfortunately you have to display the code, and the description appears in the "comment" on the right, just like in a regular Windows program.

cheers
Bruce


Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: NT7.20 Change from Drop to string lookup problem
« Reply #6 on: September 04, 2013, 05:40:03 AM »
OK, I understand the reason now. But if "Force user to use lookup" is checked, then program would not need to use the description key to fetch the record id. Just a thought.
Rob.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: NT7.20 Change from Drop to string lookup problem
« Reply #7 on: September 04, 2013, 09:42:54 PM »
yeah it would.
The "type in the description" is part of the problem, but the real problem is the text sent back to the server when the user clicks on Save. Clicking on the "force" option doesn't change that.

cheers
Bruce