NetTalk Central

Author Topic: Re: Problem with GetDescription  (Read 4324 times)

pkonyk

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Problem with GetDescription
« on: September 18, 2014, 01:51:22 PM »
I have give you an example Bruce. I've been fighting with this for several weeks on and off.

Here is the situation. A table with only two key fields -- the primary (unique, auto numbered) and a description (unique) field.

Some sample data:
ID      Description
1        A01
2        A02
...
6        32    ! Yes this is the description that is a number and matches an ID
...
10      57    ! Another description that is a number and matches an ID
...
32      A19
...
57      S21

Your code in NetWeb.clw in NetWebServerWorker.GetDescription will fail for description "32" and description "57". This because
  err = self.GetFile(p_file,CodeKey)  !line 10266
will be set to 0 since 32 (as a description) will be found in the ID field and "A19" will be returned as the description. And if 57 (as a description) is looked for the result will be "S21".

In summary, because the description field matches an ID entry (by coincidence) an incorrect description and ID is returned.

I suggest that you add a template option. Something like, "Use description key only for look ups"

Cheers,

Paul

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Problem with GetDescription
« Reply #1 on: September 18, 2014, 08:04:44 PM »
Hi Paul,

I understand the issue, and I'll consider a switch - but the ability to enter both the code or the description is by design, and I wouldn't want to lose that.

I've split this into a separate thread because it has nothing to do with Brians report on the locator that I can see.

cheers
Bruce

pkonyk

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Problem with GetDescription
« Reply #2 on: September 19, 2014, 06:35:04 AM »
Thanks Bruce!

I've struggled with disabling / overriding this "by design"  behaviour. I have to keep changing the value that is looked up. And, just before the write to disk, I change it one last time.

Could you suggest the most efficient / effective way of doing this?

Cheers,

Paul
« Last Edit: September 19, 2014, 11:54:20 AM by pkonyk »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Problem with GetDescription
« Reply #3 on: September 21, 2014, 11:38:29 PM »
Hi Paul,

I've added a switch in 8.27 as you suggested.

At this stage though I haven't tested all the code, so if it doesn't work please maybe post a small example of appropriate app & data etc.

Cheers
Bruce

pkonyk

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Problem with GetDescription
« Reply #4 on: September 22, 2014, 08:27:31 AM »
Thanks Bruce!

I'll give it a workout and report back, with an example if needed.

Cheers,

Paul

pkonyk

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Problem with GetDescription
« Reply #5 on: September 22, 2014, 10:23:49 PM »
Hi Bruce,

Using NetDebugView, I see that the correct values are set when using the new switch. However, nothing is displayed on screen.

I have attached a demo app. It is complied with the switch set. Try it both ways. The problem field is Labour Code.Type in each of these codes 32, 32, 57 and 95. That will show you what is happening.

Cheers,

Paul

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Problem with GetDescription
« Reply #6 on: September 29, 2014, 12:00:57 AM »
fixed in 8.28