2012-04-25

[PeopleSoft] File layout converting spaces to blanks - UseSpaceForNull

[source: http://peoplesofthrms.blogspot.com.au/search/label/File%20Layouts ]

Ran into a peculiar problem while writing to a file using File Layouts today. Fields that had a space in the database was being converted to null while writing to the file. Did all the obvious checks like ensuring the Trim Spaces and Strip White Spaces properties of the FileLayout were unchecked.


Then ran into the File Class property - UseSpaceForNull. This property was introduced in Peopletools 8.48 and does the neat job of ensuring that spaces are printed in the output file instead of nulls when attempting to print fields that indeed had a space in database. It is a read-write property and has to be used immediately after instantiating the file layout as shown below:

<* Example starts *> 

If &FILE1.IsOpen Then

If &FILE1.SetFileLayout(FileLayout.FL_NAME) Then

/* has to be used immediately after instantiating the file layout */

&FILE1.UseSpaceForNull = True;

end-if;

end-if;

<* Example ends *> 

No comments: