Start a new topic

Dictionary "anything else"

I would like a dictionary that replaces one specific string with another, but any other string should be replaced by -BLANK-.  I think this is easy but I can't figure it out!

RD101 -> recurring

-> -BLANK-


1 person has this question

Thanks John. Yes, I've tried and it didn't work. I'll talk to support about the modifications. 

I wasn't 100% sure of what the outcome would be in that scenario, so I tested it and it doesn't work.  The dictionary will not blank out the already populated date value.  I see that you are currently in communication with our support team regarding the pricing and implementation of the customization, so please let them know if you'd like to move forward with that.


Thanks,


John


1 person likes this

Hi John,


We are hosted by Blackbaud - so that would be fine. How do I go about finding out how this would work and how to implement / cost it?


Another thought - could I do something like that:


Virtual fields

1. Always populate from date to column Y

2. After that date has been populated, do if gift aid column X = No, then blank


Would #1 be overwritten by #2 if #2 is added after?


Many thanks,


Grazi

The IOM API has been restricted in the Blackbaud hosting environment.  Customizations can still be created in the API but they would need to be created for you by Omatic, and we would then assist you with importing the customized profile into your hosting environment.


Thanks,


John

Thank you John, I'll research into this! Can I use IOM API when blackbaud is the hosting or only when I host it myself?


Thanks!


Grazi

Hi Grazi,


Since this functionality would require utilizing data from two different columns (if gift aid in column X = yes then populate date from column Y) it would not be possible using a dictionary.  It would be possible through a customization in the IOM API though.


Thanks,


John

HI there,


Can I do something like that, but using a field from the fields mapping as the value to be replaced?


Example:

If gift aid = yes ==> add the date from imported spreadsheet on column C

If gift aid = no ==> skip and leave it blank


I can't see how to do that using a dictionary and if I don't use one, it adds the date to all the records!


Many thanks,


Grazi

ohh, I didn't realize that you wanted to replace the valid values with something else. My solution just keeps them the same but blanks out any that don't match.

How many are you trying to match?

You could still use this technique by doing something like:
Replacement Value1: VALIDMiracle Jeans
Value to Match1: Miracle Jeans Day Holiday Edition 2013

Replacement Value 2: $2
Value to Match 1: ^(VALID|.*)(.*)



Thanks Wayne ! I'm still not clear on it though.
This is a sample of my data:
Workplace Giving
Canisters
Miracle Jeans Day Holiday Edition 2013
Icon Campaign

If the value is "Miracle Jeans Day Holiday Edition 2013" I want to replace it with "Miracle Jeans". If the value is anything else, I want to replace it with "General".
Hi Marie,

This was a fun one!


Assume that I want to replace everything but "one" and "two words" with a blank

Replacement Value  Value to Match
 VALID$1 ^(one)$
  ^(two words)$

...CONTINUE LIST...


$2 ^(VALID|.*)(.*) 

make sure to click "use regular expressions"

Explained

The first part VALID$1 and ^(one)$ will add "VALID" to the beginning of a value that matches "one".
So after step 1 the value is now VALIDone.  This is repeated for all of the values that you enter in here making sure to enclose the whole value in parentheses. 

The second part $2 and ^(VALID|.*)(.) will put either VALID or .* (the whole string) into $1 and then what is left over in $2.  The key here is that if the string does not start with "VALID" then all of the string goes into $1.  Only if the string starts with "VALID" will there be anything left over in $2.
After step 2 the value is now back to one since it had been appended a VALID in step 1.  If you try to type "two" then that will not get a VALID from step 1 and so will be blank after step 2

Give it a shot!

I'm trying to set up a dictionary with several values. If the text in the field does not match any of the values, then it should say "General".
Some of the values have spaces, and some do not. I tried Tiffany's expression, but it does not work if there are spaces.
Can someone help me figure this out?
Thanks!
Doug, welcome to the forums!

If you are just looking to say: "If there is something in the field then make it 'Blah Alumnus' but if it is blank then leave it blank"

could you just do:
Replacement: Blah Alumnus
Value to Match: .+

Then it you match any characters and replace it with the string, or match no characters and just leave it blank.
I had an issue where I was adding an education relationship in most cases, but some of the people in the input file did not have the school specified. If the school was there, I wanted the status to fill in with a certain text, but if the school was not there, status should be blank. I ended up creating a Dictionary entry with the Replacement value being my "Blah Alumnus" string and the values to match on being the RegEx expression below. This matches anything with or without spaces.

^(?!\s*$).+

^ anchors the search at the start of the string.

(?!\s*$), a so-called positive lookahead, asserts that it's impossible to match only whitespace characters until the end of the string.

.+ will then actually do the match. It will match anything (except newline) up to the end of the string.
I have come across another way to get the elusive "match anything except X" to work by using the negative lookahead function.

The expression looks like:^(?!(regex)$).* where regex  is any valid regular expression.

For example, if you wanted to make anything that was not "Male" or "Female" become "Unknown" you can use:
Replacement Value: Unknown
Value to Match: ^(?!(Male|Female)$).*

Or, to recreate my original request in this thread I could do
Replacement Value1: recurring
Value to Match1: RD100

Replacement Value2: -BLANK-
Value to Match2: ^(?!(recurring)$).*
Thanks, Tiffany! That's exactly what I came looking for! Doing the same thing with marital status and checking the spouse checkbox!
Login or Signup to post a comment