This topic is locked
[SOLVED]

 Dummy Fields on form

1/29/2018 3:11:29 PM
PHPRunner General questions
P
Penultimatum author

Is it possible to add dummy dropdown fields on an add record page in order to filter other dropdowns, but not actually add this field to the table?
My form has a number of fields like 'Hardware Name' which have amny options, and I would like a 'Customer' dropdown in order to filter these options, However, as the customer ID is already stored against the Hardware in another table I dont need to record that here. Is there a way I can add a field (in this instance as a dropdown dropdown) as a dependancy for other dropdowns, but without actually storing this field?
I did try adding the following into my SQL query:

,'' AS DummyField



And then this field is only on the Add page and provides what I need to display the form, but breaks as that obvisouly then tries inserting into this non-existent column. I believe I could do this with a view or adding a JOIN to the SQL to reference another table with Customer ID's, but then I think that would do the JOIN every time the list page is viewed etc which is probably inefficient when its only needed for an add.
Any ideas appreciated, I'm sure I'm missing something obvious. Thanks.
Jim.

Sergey Kornilov admin 1/30/2018

Your approach with dummy fields will work, you just need to make sure that this field doesn't make to INSERT SQL query. Use the following in BeforeAdd event:

unset($values["DummyField"]);


More info:

https://xlinesoft.com/phprunner/docs/update_multiple_tables.htm

mbintex 2/1/2018

I think this is a rather big one and should be pointed out more in the documentation.
It allows us to have virtual input fields on the form without the need to define some dummy variable fields. For example you could:

  • have copy function from lookup fields for setting new records based on records of other tables or standard value tables
  • split up fields for data entry in two and more, for example street and house number or telephone numbers or date and time for timestamp fields. By that controlling the input is much easier.
  • Setting variables for further scripted tasks without the need for any global fields in the database
    More ideas?