Hi there,
I am running below script succesfully in the PYTHON Creator but i can't get it to expose a created value into and attrribute. the script creates a 3 digit number in ICP_GEN_ICP based on a parameter I provide for CheckICP, but it won't get exposed. i need to know how I can assign this value to an attribute and use it in an XML templater. thanks!
ps i am new to coding ( both FME and Python)
Â
Â
script:
D = int('0x180f', 0)
H100 = int('0x100', 0)
H1000 = int('0x1000', 0)
HFFFF = int('0xffff', 0)
Â
def Asc(bytes_obj):
  '''Get the int value of a char'''
  if type(bytes_obj) == bytes:
    return bytes_objn0]
  else:
    return ord(bytes_obju0])
Â
def Mid(string, integer, integer2):
  '''Select a substring from a string'''
  integer = integer - 1
  return string  def gen_crc(icp_number):   """ Generate a checksum for an ICP"""   R = int('0', 0)     CheckICP = FME_MacroValues>'icp_number']   ICP_GEN_CRC = ""   IChar = 0   if len(CheckICP.strip()) < 12:     ICP_GEN_CRC = "Insufficient Data"   else:       CheckICP = CheckICP>:12] + "\\0\\0\\0"       #print('CheckICP: ' + str(CheckICP))     for I in range(0,108):       #print(I)       if I%8 == 0:         IChar = Asc(Mid(CheckICP, int((I/8)+1), 1))         #print('IChar: ' + str(IChar))       IChar = IChar * 2       #print('IChar: ' + str(IChar))       R = R * 2       #print('R: ' + str(R))       if int((IChar & H100) / 256.0) == 1:               R = R + 1       if (R & H1000) > 0:         R = R ^ D     R = R & HFFFF     #print('R: ' + str(R))     CheckICP = ("000" + format(R,'x'))Â-3:]     #print('CheckICP: ' + str(CheckICP))     ICP_GEN_CRC = CheckICP.upper()     # below ICP_GEN_CRC should be put in an attribute that i can use in an XML-creator.     print('ICP_GEN_CRC: ' + str(ICP_GEN_CRC))   return ICP_GEN_CRC  i expose ICP_GEN_CRC as output attribute , but it returns empty.