October 14, 201015 yr hi everyone, i'm working on a search feature that would set a field with two different values (either A or , but the script didn't seem work.. Here is my script- $omitHHnoLetter is a check box field If ($omitHHnoLetter="Omit HH no letter") set field (babies::letter = "Yes") set field (babies::letter = "Letter sent") end if The script is recognizing the second criteria (the second criteria seems overriding the first one) So is there a way to combine these two criteria to make both of them valid for the same search? i really am looking for records with the "letter" field equal to Yes or Letter sent. i tried set field (babies::letter = "Yes" or "Letter sent") but it didn't work.. Please advice. Thank you! Qinqin
October 14, 201015 yr I find this very hard to follow (see below why), so this is purely guessing: If [ $omitHHnoLetter = "Omit HH no letter" ] Set Field [ babies::letter ; "Yes" ] Else Set Field [ babies::letter ; "Letter sent" ] End If $omitHHnoLetter is a check box field Hopefully, you don't have a field whose name starts with a "$"??! Also, a checkbox field can contain more than one value, and the test CheckboxField = "Some Value" will fail when the field has "Some Value" checked along with another value/s. The script is recognizing the second criteria What second criteria? I see only one criterion here: either $omitHHnoLetter equals "Omit HH no letter" or it doesn't. set field (babies::letter = "Yes") That's not a valid syntax for the Set Field[] step.
October 18, 201015 yr Author Hi comment. Sorry about the confusion. I meant "two criteria" because there are two conditions for a household that would be considered registered. One is baby::letter = "Yes" and the other would be baby::letter = "DBL" Either of these would qualify, and that was where I had trouble with. Because I wanted to put conditions/criteria down to define the search, but only the second condition (whichever comes the second) would be recognized. What I essentially want is to have the "letter" field defined as either "Yes" or "DBL." is there a way to do that? Any ideas on how I can define two conditions for the same field. Thanks!
October 18, 201015 yr I am still not sure I understand what you are after. To find records whose Letter field contains "Yes" or "DBL" you can: Enter Find Mode [] Set Field [ Babies::Letter ; "Yes" ] New Request Set Field [ Babies::Letter ; "DBL" ] Perform Find []
October 18, 201015 yr Author HI sorry about the unclear msg. I tried using the "new record" line, but since i have other criteria to construct this big search, when i did "new record" it is combining the big search with one registration condition with the other registration condition... ok, let me try to explain it more.. this is just a rough version of my script- enter find mode[] set field[...] set field[...] if (....) set field[babies::letter; "Yes"]; set field[babies::letter; "DBL"]; end if in this case, the search is doing for records that with letter field that is set "DBL" instead of "Yes" or "DBL" and if I tried set field[...]; -- other conditions set field[...]; if (...) set field[] -- condition 1 new record set field[] -- condition 2 end if The search is looking for records that meet the other conditions and condition 1 PLUS those that meet condition 2.. i'm looking at a script to look for records that meet other conditions along with condition 1 and condition 2. Hope it makes sense.
October 19, 201015 yr In this part: if (....) set field[babies::letter; "Yes"]; set field[babies::letter; "DBL"]; end if you are setting the field to "Yes", then canceling what you just did by setting it to "DBL" (and nothing else). You could set the field to both, but that would only find records that contain both "Yes" AND "DBL". To do an OR search, you must use another request. If you have other criteria to consider, try: Enter Find Mode [] Set Field [ ... ] Set Field [ ... ] Set Field [ ... ] ... # If [ ... ] Set Field [ Babies::Letter ; "Yes" ] Duplicate Request Set Field [ Babies::Letter ; "DBL" ] # Perform Find []
October 19, 201015 yr I'm sure Comment has you covered but I would also question ... what is your If[] test while in find mode? If it involves field values, it will fail because fields/records have no value in find mode.
October 20, 201015 yr Author Thank you, comment! Duplicate Record was what I needed.. It works now. Thanks again.
October 20, 201015 yr Author Hi Thanks for asking about my find feature. I used some if statements to include search criteria where users choose to apply during their search. There are check boxes in my user interface asking people if they want to include premature babies or households that have not been given regsitry permission and such in their search.. It works so far.. Thanksfully..
January 27, 201115 yr Hi Thanks for asking about my find feature. I used some if statements to include search criteria where users choose to apply during their search. There are check boxes in my user interface asking people if they want to include premature babies or households that have not been given regsitry permission and such in their search.. It works so far.. Thanksfully.. I don't know if you've found a permanent answer to your question, but the way we solve this problem is: Set Field [saying; "Hi"] Perform Find [] Set Field [saying; "Goodbye"] Extend Found Set [] In this example, it will search for both "Hi" and "Goodbye" in the field labeled "Saying". Hope this helps. - Dan
Create an account or sign in to comment