This function will return the information from a string as an array, You can use it to put a multi line lookup in a normal text file, or to generally separate lines based on a special value in the string.

Call this function like

LET MyBrandNewArray = IHSLineSeparation("_LS_", "Line_LS_OtherLine_LS_Newline")

or use it directly in the content property of a field on the format. You can find the content property by clicking on a field the Click on properties, the on the bottom of the window select 'runtime' and if the field is a dynamic field (a T with a question mark) you will see the Content property.

Use the function like :

= IHSLineSeparation("#", CI("SomeDetailVariable"))

assuming you have a variable SomeDetailVariable in that section.

Save this as function as a text file in the fun folder as IHSLineSeparation.fun


// 
FUNCTION "IHSLineSeparation" ACCEPT lsCharCode, lsOrgString

 DESTROY lsResult, lsCharPos

 LET lsCharPos = WHERE(lsCharCode,lsOrgString)

 IF (lsCharPos=0) THEN
   LET lsResult = lsOrgString
 END IF

 WHILE lsCharPos > 0

  IF lsCharPos = 1 THEN
    LET lsOrgString = " " & lsOrgString
    LET lsCharPos = 2
  END IF

  IF lsResult = "" THEN
    LET lsResult = lsOrgString[1,1->lsCharPos-1]
  ELSE
    LET lsResult = << lsResult ,lsOrgString[1,1->lsCharPos-1 ]>>
  END IF

  LET lsOrgString = lsOrgString[1,lsCharPos+ LENGTH(lsCharCode)->LENGTH(lsOrgString)]
  LET lsCharPos   = WHERE(lsCharCode,lsOrgString )

  IF (lsCharPos =0) AND (NOT ISBLANK(lsOrgString) )THEN
    LET lsCharPos= LENGTH(lsOrgString)+1
  END IF
 END WHILE

 DESTROY lsCharCode, lsOrgString, lsCharPos

 RETURN lsResult
END FUNCTION 



Gesponsorde koppelingen