NetTalk Central

Author Topic: Help needed with String Field and Lookup Button  (Read 3178 times)

GFasolt

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • GFasolt.com
    • Email
Help needed with String Field and Lookup Button
« on: March 02, 2010, 06:31:00 AM »
Using a NetWebForm with a String field using a lookup button.

The child file (the look-up) is related to the parent (the form) by an identity value in support of normalization.

Code: [Select]
Parent FILE,PRE(PAR)
ParentID  LONG
ChildID  LONG
Name  STRING
        END

Children  FILE,PRE(CHI)
ChildID  LONG
Name  STRING
        END

Template settings:
Field: PAR:ChildID
Type: String
Lookup button: [X]
From file: Children
Order by: CHI:Name
Value field: CHI:ChildID
Description field: CHI:Name

Problem: The NetWebForm string displays the PAR:ChildID value rather than CHI:Name.  How can I hide the PAR:ChildID value and display the CHI:Name instead?
   

[attachment deleted by admin]

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Help needed with String Field and Lookup Button
« Reply #1 on: March 02, 2010, 10:11:35 PM »
There is an option to display the name in the comments field.

The other way is to create a string local variable and force them to use the lookup and then assign your other values via the settings on the template

GFasolt

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • GFasolt.com
    • Email
Re: Help needed with String Field and Lookup Button
« Reply #2 on: March 03, 2010, 07:19:47 AM »
Thanks, Kevin.

The local variable is such an obvious solution I am embarrassed that I didn't think of it.

The lookup is working just fine now, but I'm having trouble priming the local variable when I open the from in edit mode.

I've added the value field to the session variables in the browse, but it is empty when I check it when opening the form, so I'm unable to prime the local variable.

Any help would be appreciated.

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Help needed with String Field and Lookup Button
« Reply #3 on: March 03, 2010, 01:55:06 PM »
Generally what I do is create an UpdateDesc Routine and then call that from the pre-insert and pre-update embeds on the form. This is where I prime the values and add it to the SSV.

GFasolt

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • GFasolt.com
    • Email
Re: Help needed with String Field and Lookup Button
« Reply #4 on: March 03, 2010, 05:20:17 PM »
Got it - thanks.

It was necessary to load the file record based upon the session value for the record ID. I was not able to pass the string value from the browse as a session value even though it was defined as a hot field and session value there. Is this right?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Help needed with String Field and Lookup Button
« Reply #5 on: March 03, 2010, 08:49:24 PM »
Hi Greg,

yes, that's right. The only thing "passed" from the browse to the form is the unique identifier for the record.
Remember that when the button is pressed in the browser, _nothing_about the browse exists on the server anymore.

Cheers
Bruce

GFasolt

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • GFasolt.com
    • Email
Re: Help needed with String Field and Lookup Button
« Reply #6 on: March 04, 2010, 04:57:19 AM »
Thanks Bruce.

I'm catching on, it's just a bit painful and expensive in terms of time.

The results are just great, though. Perhaps I'll find the time and courage to try a relation tree sometime soon, that is I will unless you intend to implement something soon yourself.