Start a new topic

Letter code based on gift amount

Does anyone know of a way to set a virtual field or dictionary for Letter Code based on Gift Amount? Gifts of $1000 or more have one letter code, gifts under $1000 have another code.

Hi Marie,

This sounds like a good candidate for a simple custom function.  Below I have given you a sample.  You would set this custom function as the "Function" of the virtual column and set the "Seed" to be the column with the gift amount.


If oField.Value  
 
For more information on how to create a custom function see http://www.omaticsoftware.com/Forum...fault.aspx
Thank you, Wayne. I have not created a function before, but I will give it a try!
Wayne, where does the cursor go when I click on Add Virtual Column? I can't see most of the screen prints.
Thank you.
Imports Microsoft.VisualBasic
Imports System
Imports System.Linq

'This code is specific to your current profile

Public Class Profile

    Inherits ImportOM.API.ProfileBase

--> Cursor Here

Public Overrides Sub BeforeImport(ByVal Cancel As ImportOM.API.iCancel)

'Import has not been started yet

End Sub

Thanks for your help Wayne. I can't get this to work though. I added the code, I see it as a Function, and picked the seed column. I don't
get any errors when I test the code, but the letter code does not populate. I''m not sure what I am missing.
Marie, can you post all your relevant code?
Make sure that you selected the function as well as the seed.

If the letter is ending up blank then the function is not running because the function would set one of those values.
This is my code
_
Public Function ComputedColumn_635405005490884063( _
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 = ""
Return sReturn

If oField.Value sReturn = "OR-Online Receipt"
Else
sReturn = "MCHF-Receipt"
End If
End Function

In my virtual field, I have the function Test Letter Code, and the Seed is N, which is the column for Gift Amount.
The line that says "Return sReturn" ends the function at that point, returning an empty string and exiting the function. Try removing that line.
Actually, you need to move that line to after "End If". The other option is to get rid of sReturn altogether and use Return "OR-Online Receipt" instead of assigning it to variable and returning the variable at the end.
That's the ticket! I have it working now.
Thank you Jeffrey and Wayne.
Teamwork!
Is that very first underscore in your code? It should not be if it is.
Amy,

You appear to have lost this portion of the code:

Public Class Profile
Inherits ImportOM.API.ProfileBase

This should go directly after the comment of the code being specific to your profile
Login or Signup to post a comment