Skip to main content

Python String Custom Functions

I just put together a package of python scripts for the IDEA Equation Editor. There are 18 functions that add on what you can do to a character string. You can find the package here:

http://ideascripting.com/IDEA_Lab/python-string-custom-functions

kritesh anand Wed, 05/29/2019 - 06:18

User defined function. In&nbsp;Python, a&nbsp;user-defined function's&nbsp;declaration begins with the keyword def and followed by the&nbsp;function&nbsp;name. The&nbsp;function&nbsp;may take arguments(s) as input within the opening and closing parentheses, just after the function&nbsp;name followed by a colon.</p>
<p>If you want to enahnce your learning on Python then you <a href="http://pythonandmltrainingcourses.com/courses/best-python-training-in-n…">best python training classes in Noida</a>

TMC Thu, 03/12/2020 - 09:36

Hi Brian,
 
Access denied
 

You are not authorized to access this page.
 
:-S
 
I cannot get my custom python function to work How do I do this properly: pseudocode:
import fuzz from fuzzywuzzy
def CompareTwoFields(field1, field2):
           return fuzz.ratio(field1, field2)

Brian Element Wed, 01/13/2021 - 08:27

Hi Humphrey,

The pages have been taken down as it is now part of the IDEA Lab which is part of IDEA.

The problem with your return is that it has to return a string, so you have to cast your return value to string before IDEA will read it.

Here is an example:


#
# Usage example: appending a virtual character field to the Sample-Detailed Sales database.
# Equation example: @Python("GetPercent", SALES_TAX, SALES_BEF_TAX)
#
def GetPercent(numerator, denominator):
	if(denominator == 0): 
		return "N/A"
	return "{0:.2f} %".format(numerator/denominator*100)