NetTalk Central

Author Topic: Display extra fields in drop list?  (Read 7636 times)

Alan Telford

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Display extra fields in drop list?
« on: June 18, 2008, 07:37:30 PM »
How do I display extra fields in drop list.

This works fine for a single display field:
  Display = EMP:Name
  Value  EMP:ID

But how do I do the following:
  Display = EMP:FirstName & ' ' & EMP:Lastname
  Value  EMP:ID

i.e. I want a calculated field to show in the dropdownlist.
Is this possible?

Alan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Display extra fields in drop list?
« Reply #1 on: June 19, 2008, 07:22:02 AM »
Hi Alan,

yes, the dropped field can be an expression.
Although, in your case, a better expression would be

Description Field:
clip(EMP:FirstName) & ' ' & EMP:Lastname

Also, remember to add Emp:FirstName, and Emp:LastName to the hot-fields list for the drop down.

Cheers
Bruce

Alan Telford

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: Display extra fields in drop list?
« Reply #2 on: June 19, 2008, 12:59:27 PM »
Thanks so much!!!
 I'd tried before, but I guess I'd probably forgotten to add the extras as HOT fields.

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Display extra fields in drop list?
« Reply #3 on: September 16, 2008, 06:07:12 AM »
Hi Bruce,

OK, let's get real nasty...

I have 2 files, Sections and Perils, linked something like this

Section   PerilCode
    1          FIRE
    1          WATER
    1         ACDA
    2         FIRE
    2         ACTP
...
   99       FIRE


PerilCode    Description
ACDA        Accidental Damage
ACTP         Accident Third Paerty to Blame
FIRE           Fire
WATER      Water damage - Burst Pipe

Obviously I have a Filter on the Section File to display only that Section, Problem comes into trying to show description on Peril file.  The app uses NetWebForm from memory, so I am trying to populate local:test.

The problem is I can't link Perils to Sections in [Tables] and I cannot put the Advanced Link File Perils in options without having it in [TABLES], so the view generate the Peril Description outside the join statement...

l:test_OptionView   View(SectionPerils)
                          Project(SPer:PerilCode)
                          Project(PER:Description)
                          JOIN(PER:KeyPerilCode,SPer:PerilCode),INNER
                          End
                        End

                 and generate error Field not found in parent FILE      (UsingNetTalk 4.30)

Any ideas?

Charl

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Display extra fields in drop list?
« Reply #4 on: September 16, 2008, 11:41:50 PM »
>> The problem is I can't link Perils to Sections in [Tables]

Why not? Do you have a relationship defined in your dictionary?

Cheers
Bruce

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Display extra fields in drop list?
« Reply #5 on: September 17, 2008, 12:21:42 AM »
Yep, Perils 1:MANY SectionPerils.

The problem is that 'Related Tables' Tab is nos in the NetWebForm Template, see the attachment.

Hope this help.

Thanks

Charl

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Display extra fields in drop list?
« Reply #6 on: September 17, 2008, 11:04:31 PM »
Hi Charl,

ah - yes - I follow you now. Thanks for the doc.

Just one question - Are you hand-coding any of that JOIN statement?

Cheers
Bruce

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Display extra fields in drop list?
« Reply #7 on: September 18, 2008, 03:26:39 AM »
Bruce,

Short and Sweet, Nope. 

Charl

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Display extra fields in drop list?
« Reply #8 on: September 18, 2008, 07:05:48 AM »
Hi Charl,

great - I've got you 100%.

2 things;

a) I've added code to PR 14 so the Join gets done for you. You'll add the file to the Tables button, and add it as a HotField - but the template will just generate the VIEW correctly...

b) you've set the "Link File" in an attempt to make it work - but that's wrong, so just remove that setting.

If you're in a big hurry, then the workaround for this is;
a) remove the field as a hotfield
b) hand-code the Join inside the view (in the provided embed point).
c) and of course remove the incorrect link file mentioned above.

Cheers
Bruce

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Display extra fields in drop list?
« Reply #9 on: September 19, 2008, 05:08:41 AM »
Bruce,

Cool.

But I am a mad man, I just removed the thing and allocate it a code 99, something like Web Thingy Peril Code for now.  Easy work-around...  In the proper app I make sure they change that.

I'll check it next week.

Cheers

Charl