Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Data type

Documentatie

Manier van omzetten in U-turn

long

https://docs.python.org/2.7/library/functions.html#long

Code Block
languagepy
def DataTypeCell_Long(val):
	try:
		return long(val)
	except:
		return long('0')

Decimal

https://docs.microsoft.com/en-us/dotnet/api/system.decimal?view=netcore-3.1

Code Block
languagepy
def DataTypeCell_Decimal(val):
	try:
		return System.Decimal.Parse(val)
	except:
		return System.Decimal.Parse('0')

DateTime

https://docs.microsoft.com/en-us/dotnet/api/system.datetime?view=netcore-3.1

Code Block
languagepy
def DataTypeCell_DateTime(val, formatStyle=''):
	if formatStyle == '':
	  formatStyle = 'yyyy-MM-ddTHH:mm:ss'

	try:
		return System.DateTime.ParseExact(val,formatStyle,None)
	except:
		return None

Date

https://docs.microsoft.com/en-us/dotnet/api/system.datetime?view=netcore-3.1

Code Block
languagepy
def DataTypeCell_Date(val, formatStyle = ''):
	if formatStyle == '':
	  formatStyle = 'yyyy-MM-dd'

	try:
		return System.DateTime.ParseExact(val,formatStyle,None)
	except:
		return None

Boolean

https://docs.python.org/2.7/library/stdtypes.html#boolean-operations-and-or-not

Code Block
languagepy
def DataTypeCell_Bool(val):
	if val.lower() in ['true', '1']:
		return True
	elif val.lower() in ['false', '0']:
		return False