Start a new topic

RegEx Help: Translate Gift Amount (by range) into Letter Code

We would like to translate the gift amount (by dollar range) into specific letter codes.  For example:

 

Gift Amount $1.00 - $1000 = General Thank You Letter

Gift Amount $1001 - $5000 = Special Thank You Letter

Gift Amount > $5001 = Major Donor Thank You Letter

 

Can RegEx be used to identify ranges like this??

 

Thank you!

 

Tina


1 person has this question

Thanks Jeff!  This is great!

 

Hope all is well :)

 

Tina

Hello stranger, long time!   :)

Technically you ~can~ use RegEx to figure out numeric levels, but as RegEx is meant for text and not numbers, it gets hairy quick (here's a glimpse if you're brave: http://www.regular-expressions.info/numericranges.html).

 

A much better solution is using ImportOmatic's API. Given a profile like this small sample:

 

You could create a Virtual Field to be the Letter Code and create a function like this to determine the value based on Column C (gift amount):

image

 

Here's the code in text form, hope this helps!

 

image

 

_

Public Function ComputedColumn_635918705544961467( _

ByVal oField as ImportOM.API.iField, _

ByVal Cancel As ImportOM.API.iCancel) As String

'This function must return a text value

Dim sReturn As String = ""

Select Case True

Case val(ofield.Value)

sReturn = "copper"

Case val(ofield.Value) >= 1000 And val(ofield.Value)

sReturn = "silver"

Case val(ofield.Value) >= 5000

sReturn = "gold"

End select

Return sReturn

End Function    

Login or Signup to post a comment