briandye Posted September 14, 2007 Posted September 14, 2007 I have a series of checkboxes that list many product lines. The user is being asked with the check boxes to check the product lines they wish to be a part of the Sales Quote they are creating. Lets say for example I have these product lines. Widgets Gadgets ThingaMaBobs The user checks off Widgets and Gadgets. I then want to switch to the view that the sales quote template is defined in and run a search. However I want it to search based on products that are Widgets OR Gadgets. I have the field defined as a variable $productsToQuote The value obtained from the check box lists all fields checked, however I cannot figure how to search this way. Is there away to search a single field using multiple search parameters? Right now I am doing: Enter Find Mode[] Set Field [Products::LineCode, $productsToQuote] Perform Find [] This works just fine if there is only one product line checked off. However if there is more than one it filled the search field with all the product lines stacked one on top of another, and obviously returns no results... Any help would be much appreciated.
IdealData Posted September 15, 2007 Posted September 15, 2007 You can use the New Record command whilst in Find mode to make an additional find request. Then you can use another set field... The tow find requests are added together when you perform the find.
briandye Posted September 17, 2007 Author Posted September 17, 2007 Okay sounds great, checkbox fields contain the values of every variable checked so if the user checked the first three values the output of the field would look like this: Value1 Value2 Value3 Is there an easy way to strip the first value, perform a search, strip the second perform a search, etc etc.
IdealData Posted September 22, 2007 Posted September 22, 2007 Have a look at "constrain found set". The RECORDS menu changes to REQUESTS in find mode, then you get the options to CONSTRAIN or EXTEND.
Fenton Posted September 22, 2007 Posted September 22, 2007 If it's an "or" Find, as you first posted, then you would need a New Request for each value of the checkbox field (gCBX). I'm assuming the checkbox field for the choices is a global field. Psuedo code: Enter Find Mode [] Set Field [ CBX; GetValue ( gCBX; 1) ] If [ ValueCount ( gCBX ) > 1 ] Set Variable [ $count; ValueCount ( gCBX ) ] Set Variable [ $counter; 1 ] Loop Exit Loop If [ $counter > $count ] New Record/Request Set Field [ CBX; GetValue ( gCBX; $counter ) ] Set Variable [ $counter; $counter + 1 ] End Loop End If Perform Find
briandye Posted September 25, 2007 Author Posted September 25, 2007 (edited) Fenton, Thanks for the help so far, I am still a little hung up. Do I need to pull the values in the checkboxes and store them as comma separated values first? I am still only retrieving the first checked value in the list... Edited September 25, 2007 by Guest
briandye Posted September 25, 2007 Author Posted September 25, 2007 I cannot make the check box field a global field since each record may require different products to be quoted. I have tried to define the variable before switching views and then using the variable instead of the field, but it does not seam to capture all of the checked values, just the first value checked. Here is what I am doing. Sales Orders::collectionsToQuote Is the checkbox set residing in the Sales Order. The collections to display in the quote would be checked here. Inventory::collectionCode Is the pull down menu field residing in the inventory file. Each piece of inventory can only be a part of one collection. Set Variable [ $collections; Value:Sales Orders::collectionsToQuote ] Set Variable [ $$logo; Value:Sales Orders::customerLogo ] Allow User Abort [ Off ] Go to Layout [ “SalesModelCreation” (Inventory) ] Enter Find Mode [ ] GetValue (Sales Orders::collectionsToQuote; 1) ] Set Field [ Inventory::collectionCode; GetValue ($collections; 1) ] If [ ($collections) > 1 ] Set Variable [ $count; Value:ValueCount ($collections) ] Set Variable [ $counter; Value:1 ] Loop Exit Loop If [ $counter > $count ] New Record/Request Set Field [ Inventory::collectionCode[GetValue ($collections; $counter)] ] Set Variable [ $counter; Value:$counter + 1 ] End Loop End If Perform Find [ ] Does this make sense or am I way off base?
Fenton Posted September 25, 2007 Posted September 25, 2007 I don't really know if it makes sense, as I don't really know your data structure. But I can see a few minor problems in your script, so try this: Set Variable [ $collections; Value:Sales Orders::collectionsToQuote ] Go to Layout [ “SalesModelCreation” (Inventory) ] Enter Find Mode [ ] Set Variable [ $count; Value:ValueCount ($collections) ] Set Field [ Inventory::collectionCode ; GetValue ($collections; 1) ] If [ $count > 1 ] Set Variable [ $counter; Value:1 ] Loop Exit Loop If [ $counter > $count ] New Record/Request Set Field [ Inventory::collectionCode [GetValue ($collections; $counter)] ] Set Variable [ $counter; Value:$counter + 1 ] End Loop End If Perform Find [ ]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now