NetTalk Central

Author Topic: Auto complete on non-unique field?  (Read 4633 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Auto complete on non-unique field?
« on: September 18, 2018, 12:35:27 AM »
Hi,

I have a client file, and the surname field is not unique.
eg. There are many "smith"s

The entry field is for the client_id, but I display the client name and some other fields to show which client it is
eg.
Name & addres_1 & address_2

This works quite well except the unique client_id is not loaded into the entry fields, but always the description.

I am assuming that it is because of the name not being unique and possibly the lookup with the name does not get a unique record,
and then returns the description field and not the value field.

Is there a way to intercept this and store the unique client id of the client the user has selected?


thanks

Johan




Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Auto complete on non-unique field?
« Reply #1 on: September 18, 2018, 10:39:12 PM »
>> Is there a way to intercept this and store the unique client id of the client the user has selected?

nope. The "description" field you use has to be unique. Only the description field is returned.

What I would typically do in this circumstance is create a new (unique) field in the table - typically containing all you want to display in a single unique field. Then the user selects that - and from that you can get to the ID.
Yes, it's an extra field in the dict - but that's not a problem these days.

cheers
Bruce

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Re: Auto complete on non-unique field?
« Reply #2 on: September 19, 2018, 02:01:19 AM »
Hi Bruce

Thanks,
Cool idea with the extra field.

Will look at which fields I will duplicate and concatenate together to make the new "super" field,
Thinking along the lines of name, first name, adress1 and address2, country

Only issue would be to make sure the super field is updated when changes are made to the other fields

thanks

Johan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Auto complete on non-unique field?
« Reply #3 on: September 19, 2018, 05:26:05 AM »
>> Only issue would be to make sure the super field is updated when changes are made to the other fields

typically I update the field in the global file manager embed points. So it gets done on Insert, TryInsert, Update and TryUpdate.

Cheers
Bruce