Skip to main content

Custom Functions

Description

Post any examples of custom functions in this forum

Adjusting a Charachter Date/Time field to add or subtract 1 hour

I have imported a Date/Time field from an outside source and need to add 1 hour to the time to compare CST against EST. The field is formatted as Character/19 and contains YYYY-MM-DD HH:MM:SS. 
I'm sure there must be a simple solution to add or subtract hours from a Date/Time to adjust for different timezones but I can't find it.  Can you help?
 
 

Appending a field with a result of more thn 6 decimals

What is teh best way to get a calculated result within a column with more than 6 decimal.
I have a column and i need to devide the amounts in that column by 0.1234564879 and need teh results of delimal atleast 15 digits. . When i tried this, i am getting teh results as 0.00 as the digits are more than 6 and till 6 digits, most of the values are zeros. I can not change any fields into thousands or millions. Please let em know if this can be possible.
Thanks,
Bibin

How to use filter contains the list of words (60 keywords)

Hi Team,
Please guide me how I can filter for contins of list of words in specific field.
I have already used the isin function however it can be use for 4-5 times.  I need to find the 60 keywods in one specific field pls suggest the appropriate function in IDEA.
Regards
Nilesh
 
 
 

showFormat

This custom function will show you the format of a character field.  It will change 0 to 9 to "9", uppercase characters as "X" and lowercase characters as "x".  All other characters will stay the same.

Here are a couple of examples:

  • #showFormat("ABCDEF") = "XXXXXX"
  • #showFormat("12345") = "99999"
  • #showFormat("Invoice 345/34-45") = "Xxxxxxx 999/99-99"

The custom function works only on a character field.  When creating a virtual field make sure that there is the same number of characters as the original field.

FIRSTDIGIT - extract the first digit from a numeric field

This custom function comes out of a scripting course I give in which we create a script that performs benford 1st digit analysis at the client or vendor level instead of over the entire database.  One of the steps is to extract the first digit of the numeric field that we are looking at.  So usually we create the forumal using the equation editor but I thought it would be fun to create a custom function to do the same thing.  So here it is, it should be easy to modify for more than 1 digit.  It will extract the first digit, it ignores the negative sign and if the number