Solved Use wildcard search with multiple words (1 Viewer)

dwaynesworld

New member
Local time
Today, 01:23
Joined
Oct 8, 2021
Messages
4
I am attempting to run a query where I search for records with similar values and create boolean values for these entries. A sample of one of my fields is listed below:

1633708846835.png

I would like to create a field with the values from this field combined by using a wildcard. Here is an example of my expression:

Fed_Gov: IIF([source_data]![funding_source]="Federal Government", 1, 0)

I would like to include all values starting with "Federal Government" in this expression. I tried adding a wildcard character "*" with no results. Please help!!!!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:23
Joined
Oct 29, 2018
Messages
21,477
Have you tried using the Like operator? I'm not sure I understand your question, actually. Sorry.
 

plog

Banishment Pending
Local time
Today, 00:23
Joined
May 11, 2011
Messages
11,648
First, each distinct value should go into its own field. You don't subdivide data in fields by delimiting them with a character (e.g Value1|Value2|VAlue3|etc..). Instead you need to build your tables to accomodate that data properly.

I would like to include all values starting with "Federal Government" in this expression.

Going off that, you need this expression:

Fed_Gov: IIF([source_data]![funding_source] Like "Federal Government*", 1, 0)


That works with what you explicitly stated. It does not work for anything that doesn't start with "Federal Government" which means it will return 0 for the record with the value "Internal Funding | Federal Government"

Again though, this should be avoided entirely by properly structuring your data.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:23
Joined
May 21, 2018
Messages
8,536
See if something like this is what you mean.
I can type
Internal Funding | Other | No Funding
then from there do lots of combinations to match one of those, all of those, some of those.
You probably just need to modify one line of code to split it on "|" or whatever your delimiter is. I was splitting each word. Then I add the words to my listbox. Then I choose AND or OR comparisons. Then pick one, more, or all.
 

dwaynesworld

New member
Local time
Today, 01:23
Joined
Oct 8, 2021
Messages
4
Have you tried using the Like operator? I'm not sure I understand your question, actually. Sorry.
What I would like is to have all variables starting with "Federal Government" included in the statement. For instance, "Federal Government", "Federal Government | Other", "Federal Government | Private Industry" etc would be included. However, "Internal Funding | Federal Government" would not be included as it will reside under the "Internal Funding" variable. I hope this helps.
 

dwaynesworld

New member
Local time
Today, 01:23
Joined
Oct 8, 2021
Messages
4
First, each distinct value should go into its own field. You don't subdivide data in fields by delimiting them with a character (e.g Value1|Value2|VAlue3|etc..). Instead you need to build your tables to accomodate that data properly.



Going off that, you need this expression:

Fed_Gov: IIF([source_data]![funding_source] Like "Federal Government*", 1, 0)


That works with what you explicitly stated. It does not work for anything that doesn't start with "Federal Government" which means it will return 0 for the record with the value "Internal Funding | Federal Government"

Again though, this should be avoided entirely by properly structuring your data.
Thanks for your reply. Unfortunately I do not have access to the source tables to change these fields. I did try what you suggested and this was exactly what I was looking for! I appreciate your help with this. Have a great day!!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:23
Joined
Oct 29, 2018
Messages
21,477
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom