Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 405
  • Last Modified:

DBColumn - OnSelect

I have a dialogbox 'CustName' with a @DBColumn to get its selection values.  Once the user has selected the value from the dialog box I have a number of editable fields e.g 'address','phone' which I want to populate by a DBLookUp to a view for the details.

How can I do this? Do I use the OnSelect?
1 Solution
Use @DbLookup to find the matching values by passing the selected value. Then populate the values on the fields. If these can be computed they can automatically populated if they are editable then you might have to look for some roundabout way like clicking a button or writing the code in appropriate events (not an efficient way though).

Check @DBLookup help on details of how to get the values.

fayebAuthor Commented:
They have to be editable as users have to be able to add a new cust as well as select new ones.
You could also use @Picklist instead of the @Dialogbox, and retrieve @Text(@DocumentUniqueID) from a hidden column.
Using @GetDocField you could obtain one or more fields without additional (slow) @DbLookups.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

fayebAuthor Commented:
The application is web so I cant use @picklist
fayebAuthor Commented:
The application is web so I cant use @picklist
For the web I often use a different approach. I prefer this method because it doen't need any refreshes or (slow) @DbLookups. I haven't got a working example around, but if you know some javascript, here's how it works:

Create a page or form. It's contents should be interpreted as HTML.
On it you place a view in HTML, delivering the options for the HTML select statement, providing the text (what to select) and the values (alias). The values can be the concatenated value for the different fields, like:

  <OPTION VALUE="value1@value2@value3">Choice 1
  <OPTION VALUE="valueA@valueB@valueC">Choise 2
  <OPTION VALUE="valueX@valueY@valueZ">Choise 3

Add the proper HTML around it:

<SELECT NAME="myField" onChange="
  i = this.selectedIndex;
  v = this.options[i].value.split('@');
  opener.myFunction(v)" Size=5>
...(place the view with the options here)...

And you've got the engine for a dialogbox in HTML/Javascript.

The opener window (where you trigger the dialogbox) should contain a javascript function to receive/distribute the field values:

function myFunction(v)

All you have to do now is change the current action that opens the dialogbox into a javascript window.open(), launching the page or form. Depending on wether you use a $$viewtemplate or an embedded view, you should open the view's or the page/form's URL.
From the action, the function or even in the onChange, you should be able to close the opened pop-up window again.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now