February 1, 201015 yr Hi all, I have been 'lurking' for a while and reading the many informative and interesting posts on the forum but I thought it was time to get involved. I am very new to FM and have enjoyed getting to grips with it. I do have a problem though and since googling has returned little of benefit I was wondering if what I am after is actually possible! So to the problem... I have two field Colours (Red, Green, Blue) and Size (Large, Small, Medium). I would like to produce a layout where checkboxes allow multiple selections to be made from each field and then to allow a find of those records. So for example I could search for -Red OR Green AND Small -Red AND Small OR Medium. I hope this makes some sense as I seem to have been going around in circles with this for quite some time!
February 1, 201015 yr FileMaker handles OR searches using multiple Find requests. E.g. you'd enter Find mode, select Red, then create a new request and select Green. Throwing AND into the mix, that field would need to be included in all the OR requests. Your first example would use the requests: - Red AND Small - Green AND Small Your next example would use the requests: - Red AND Small - Red AND Medium If you want to bypass FileMaker's Find interface to work as you described, you'd probably use global fields for the checkboxes and a script would parse them into multiple Find requests. Edited February 1, 201015 yr by Guest welcome to the forums.
February 1, 201015 yr Author Thanks for the swift reply. I have seen on a previous posting the allocation of a global script to a set of checkboxes (see below) but I am perplexed as to how I can take a set of global values and form a script to perform the AND/OR process. $counter = ValueCount (gType) Enter Find Mode loop exit loop when $counter=0 Set Field Type = getvalue (gType, $counter) set variable $counter - $counter-1 New Request endloop Edited February 1, 201015 yr by Guest
February 2, 201015 yr The basic idea is that you need to set both fields in each Find request. We grab the first size, then combine that with each color. Then we grab the next size and combine that with each color, etc. (Actually this example starts from the last value and works its way to the top of the list.) The outer loops sets the size; the inner loop creates the Find Requests. You could switch size to the inner, color to the outer, it will have the same result. Set Variable( $c ; ValueCount( gColours ) ) Set Variable( $s ; ValueCount( gSize ) ) Enter Find Mode Loop Exit Loop If( $s = 0 ) Set Variable( $size ; GetValue( gSize, $s ) ) Set Variable( $s ; $s - 1 ) Loop Exit Loop If $c=0 Set Field( Colours ; GetValue( gColours, $c ) ) Set Field( Size ; $size ) Set Variable( $c ; $c - 1 ) New Request End Loop End Loop Edited February 2, 201015 yr by Guest not tested!
February 2, 201015 yr Author Tom thanks for your time on this, I have to go out now but I will try this later this evening.
Create an account or sign in to comment