Jump to content
nextgen

How to add one extra item in Value Lists

Recommended Posts

nextgen

I have created a value list based on Products table.

 

However, while selecting products, sometime I need to select all products. While showing product name in popup menu, I want to show one more value called "All" for denoting that it applies to all products.

 

How can I do that?

Share this post


Link to post
Share on other sites
Steve Martino

Seems like a bit of a structural problem. You want to put all of the values from products into one text field?

Can you describe what's going on with your workflow, and how you use this field in your database?

Share this post


Link to post
Share on other sites
AHunter3

Here's one way of doing it:

 

Step A: I assume you already have a value list of products, the value list that does not contain "All" as a final option. Yes? If not, create such a value list. I will refer to this value list as "OriginalProductsVL".

 

Step B: Create a selfjoin relationship based on RecID = RecID of the table you are in; that is a special selfjoin relationship that actually joins this individual record to itself and no other. Let's call the new table occurence of our table "VLTableOcc"

 

Step C: Create a text field, let's call it "AdHocValueList", in this same table

 

Step D: Create a new value list, let's call it "ProductsAndAll", defined as related values only of VLTableOcc::AdHocValueList

 

Step E: Create a script, let's call it "LoadVL", with these script steps:

 

If [YourTable::AdHocValueList = ValueListItems (Get (FileName); "OriginalProductsVL" & "¶" & "All" or Get (WindowMode)≠ 0]

.. Exit Script

End If

Set Field [YourTable::AdHocValueList; ValueListItems (Get (FileName); "OriginalProductsVL" & "¶" & "All" ]

Go to Field [YourTable::Product_Dropdown_Field; select/play]

 

Step F: Format the field YourTable::Product_Dropdown_Field to use the value list "ProductsAndAll" instead of "OriginalProductsVL".

 

Step G: Attach the script LoadVL to the field itself either as a buttonscript or as triggered by OnObjectEnter

Share this post


Link to post
Share on other sites
siroos12

You can add one record to the product table and input "All" as product name for that record. This way the word "All" would show up in the value list which is based on the Product names from Products table.

 

Then set a trigger script to run on object save for the field with drop down on your layout. This script would check the value of the field, If the field value is "All" then set the target field to list of all product names. You can achieve it through a relationship or using "ExecuteSQL".

 

Please let me know if you need more clarifications.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×