This topic is locked

Extend Lookup Wizard

10/9/2007 5:58:18 PM
PHPRunner General questions
A
alang author

I had a situation where I wanted to use the "Edit as" Lookup wizard to create a more complex drop down control on one of my forms. I solved the problem with a patch to "BuildSelectControl" in commonfunctions.php (changed $LookupSQL for specific table and field) but suggest that it may be useful to include provision for this in a future version of PHPRunner.
The three main additional features I wanted was:

  1. Ability to combine fields to display in the dropdown
  2. Ability to specify a lookup combining more than one table (ie using SQL join)
  3. Order by on more than one column
    Example:

    [codebox] $cust = $smarty->get_template_vars("value_Customer");

    $LookupSQL = "select `ModelVersionID`, ".

    "concat(`models`.`Ref`,'; VER:',`modelversions`.`Version`,'; REL:',`modelversions`.`RelDate`) AS `Version` ".

    "FROM `modelversions` INNER JOIN `models` ON `modelversions`.`model`=`models`.`ModelID`".

    "WHERE `models`.`Customer`='".$cust."'".

    "ORDER BY `models`.`Ref` ASC,`modelversions`.`Version` DESC";

    [/codebox]

Admin 10/10/2007

Alan,
please see my answers below.

1) Ability to combine fields to display in the dropdown

You can do that already. Choose Custom expression in Display field box.

2) Ability to specify a lookup combining more than one table (ie using SQL join)

3) Order by on more than one column



I recommend you to create a database view with JOIN ad ORDER BY you need using CREATE VIEW command.

Then use this view as a lookup table in PHPRunner.
We'll think how to add this feature to PHPRunner.

Possibly we'll allow to choose Custom Views as a Lookup tables.

A
alang author 10/10/2007

Thanks Alexey - I can see how the database view could provide all three features BUT:

  1. If you mean at the database level, we are only using MySQL 4 which does not support views.
  2. If you mean create a custom view in PHPRunner, that's fine but the lookup wizard does not include any custom views in the drop-down list of lookup tables. I seem to recall trying that at one point.

Admin 10/11/2007

Alan,

  1. unfortunatelly no easy workaround is available for MySQL 4.
  2. This feature is not available now.We plan to add it to the next version of PHPRunner.

J
jbujosa 2/3/2009

Alan,

please see my answers below.
You can do that already. Choose Custom expression in Display field box.
I recommend you to create a database view with JOIN ad ORDER BY you need using CREATE VIEW command.

Then use this view as a lookup table in PHPRunner.
We'll think how to add this feature to PHPRunner.

Possibly we'll allow to choose Custom Views as a Lookup tables.


The problem arise when I try to use "Allow to add new values in the fly" with the view table. When I prees add new record, It appears the window to add the new record in the view. When I save it from the new window, It actualy is stored, but the it doesn't appear in the first window. ¿is this normal?

J
Jane 2/4/2009

Hi,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.