RapidIdentity Administrators' and Users' Guide

Text Adapter Actions

Open a Delimited Text file for reading.

Property

Value

Description

filesystem

expression, variable

the filesystem definition to use (default: dss server managed files)

fileName*

text, expression, variable

the name of the Delimited Text input file

charSet

text, expression, variable

the character encoding of the file (default: ISO-8859-1)

fieldNames

text, expression, variable

comma separated string containing the names of the fields in each Record

firstRecordHandling

choice (Normal, Field Names, Skip), text, expression, variable

how to handle the first Record of the file

fieldSeparator

text, expression, variable

the field separator character (default: ',')

quoteCharacter

text, expression, variable

the quote character (default: '"')

escapeCharacter

text, expression, variable

the quote character (default: the quoteCharacter)

strictQuoteHandling

boolean, expression, variable

true if strict quote handling should be enforced (default: false)

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

csvInput = openDelimitedTextInput("input.csv", "utf-8", 
    "fname,lname,dept,loc,job,status,type", "Skip", ",", "\\"", 
    "\\"", false)

Open a Delimited Text file for writing.

Property

Value

Description

filesystem

expression, variable

the filesystem definition to use (default: dss server managed files)

fileName*

text, expression, variable

the name of the Delimited Text output file

appendToFile

boolean, expression, variable

true if the file should be appended to (default: false)

charSet

text, expression, variable

the character encoding of the file (default: ISO-8859-1)

fieldNames*

text, expression, variable

comma separated string containing the names of the fields in each Record

outputHeaderRecord

boolean, expression, variable

true if a header Record should be output containing the field names (default: false)

fieldSeparator

text, expression, variable

the field separator character (default: ',')

quoteCharacter

text, expression, variable

the quote character (default: '"')

escapeCharacter

text, expression, variable

the quote character (default: the quoteCharacter)

eol

expression, variable

the character(s) to use as end-of-line (default: '\n')

quoteAllFields

boolean, expression, variable

quote all fields (default: false)

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

csvOutput = openDelimitedTextOutput("output.csv", "utf-8", 
    "fname,lname,dept,loc,job,status,type", true, ",", "\\"", 
    "\\"", false) 

Open an LDIF file for writing.

Property

Value

Description

filesystem

expression, variable

the filesystem definition to use (default: dss server managed files)

fileName*

text, expression, variable

the name of the LDIF output file

appendToFile

boolean, expression, variable

true if the file should be appended to (default: false)

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

ldifOutput = openLDIFOutput("output.ldif", false) 

Open a Text file for reading.

Property

Value

Description

filesystem

expression, variable

the filesystem definition to use (default: dss server managed files)

fileName*

text, expression, variable

the name of the Delimited Text input file

charSet

text, expression, variable

the character encoding of the file (default: ISO-8859-1)

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

textInput = openTextInput("input.txt", "utf-8", false) 

Open a Text file for writing.

Property

Value

Description

filesystem

expression, variable

the filesystem definition to use (default: dss server managed files)

fileName*

text, expression, variable

the name of the Delimited Text output file

appendToFile

boolean, expression, variable

true if the file should be appended to (default: false)

charSet

text, expression, variable

the character encoding of the file (default: ISO-8859-1)

eol

expression, variable

the character(s) to use as end-of-line (default: '\n')

returnVariable

expression, variable

name of the variable to be assigned to the return value

Example

textOutput = openTextOutput("output.txt", false, "utf-8", false, 
    "\\r\\n")

Put a line to a Text Output.

Property

Value

Description

textOutput*

expression, variable

the Text Output

line*

expression, variable

the output line

Example

putTextOutputLine(textOutput, "The quick brown fox jumped over 
    the lazy dog.") 

Put a Record to a Text Output.

Property

Value

Description

textOutput*

expression, variable

the Text Output

record*

expression, variable

the output Record

Example

record = createRecord(, )
setRecordFieldValue(record, "fname", "John")
setRecordFieldValue(record, "lname", "Doe")
setRecordFieldValue(record, "dept", "Sales")
setRecordFieldValue(record, "loc", "CA")
setRecordFieldValue(record, "job", "Manager")
setRecordFieldValue(record, "status", "Active")
setRecordFieldValue(record, "type", "Full-Time")
putTextOutputRecord(textOutput, record)

Rewind Text Input back to the beginning.

Property

Value

Description

textInput*

expression, variable

the Text Input

Example

rewindTextInput(csvInput) 

Example

# open csv input file using first line as field names
csvInput = openDelimitedTextInput("input.csv", "utf-8", 1, \',\\'
    "\\'"\false)
# open csv output file using specified field names, don't write 
    header, append if existing file
csvOutput = openDelimitedTextOutput("input.csv", false, "utf-8", 
    "sn,givenName,gender,species", true, \'\\n\')
# open ldif output file
ldifOutput = openLDIFOutput("output.ldif")
# loop through input records
forEach(record, csvInput) {
    # write record to output csv
    putTextOutputRecord(output, record)
}
# add dn and also write to output ldif
setRecordFieldValue(record, record[\'@dn\'] , "cn=" + 
    record[\'givenName\'] + " " + record[\'sn\'] + 
        "OU=Staff,OU=Internal,DC=test,DC=local")
putTextOutputRecord(output, ldifOutput)
close(csvInput)
close(csvOutput)
close(ldifOutput)

Example

# read lines from input file, transform to uppercase, and write to 
    output file
lineInput = openTextInput("input.txt", "utf-8")
lineOutput = openTextOutput("output.txt", "utf-8", "\\n")
forEach(line, lineInput) {
line = stringToUpper(line)\n putTextOutputLine(lineOutput, line)
}
close(lineOutput)
close(lineInput)