File Functions

NoReturn CloseFiles(Record node)
Closes all open file handles in the given record.

NoReturn CloseFile(FileData fd)
Closes an open file handles in the given FileData.

FileData CloneFile(FileData file)
Clones a file so it can be duplicated in a different record.

String file:Load(String file)
Loads a file on the server (in the local Files folder of the server) and returns a string. Only certain files are allowed.

String file:SaveToFile(Any data)
Saves the given file data, and returns the temporary filename it was saved to.

FileData RunReport(Path path, String id)
Runs the given report (id) at the given path, and returns this in a file data object.

FileData RunReportPdf(Path path, String id, Record input, String filename)
Runs the given report (id) at the given path, and returns this in a file data object, formatted as PDF.

FileData RunReportAsFormat(Path path, String id, Record input, String filename, String format)
Runs the given report (id) at the given path, and returns this in a file data object, formatted in the given format (eg. PDF or HTML).

FileData RunReportWithInput(Path path, String id, Record input)
Runs the given report (id) at the given path, and given parameter data (input), and returns this in a file data object.

List LoadSpreadsheet(String text)
Loads the given spreadsheet (tab-separated) text and returns a list of typeless data.

String LoadTextFile(String file)
Loads text from the given path and returns it as a string.

FileData CreateFile(String text)
Creates a new file data object.

List LoadSpreadsheetEx(String text, Path path, Any type, Boolean strictConversion)
Loads the given text as a spreadsheet (tab separated) for inserting into path. The format (type) should be TSV or CSV. Apply strict conversion to enforce types in the input data.

String SaveToSpreadsheet(List seq)
Saves the given list as a text string of TSV data, which is returns.

List LoadSpreadsheetAt(String text, Path path)
Load the given text as a TSV spreadsheet for inserting into the given path.

Record ImportXmlData(FileData fd, Path path)
Loads XML data from the given file data object into the given path, and return the record object.

Record ImportXmlDataEx(FileData fd, Path path, Boolean forceNewIDs)
Loads XML data from the given file data object into the given path, and return the record object. Optionally enforce new IDs or use the original IDs.

String RecordToXml(Record node)
Converts a record to XML format.

Record RecordFromXml(String xml, Path path)
Converts the XML to a record, with path specifying the type to use.

String ListToJSON(List seq)
Converts a list to JSON format.

List ListFromJSON(String json, Path path)
Converts JSON to a list, for inserting into the type at path.

String RecordToJSON(Record node)
Converts a record to JSON format.

Record RecordFromJSON(String json, Path path)
Converts JSON to a record, for inserting into the type at path.

String GetFileText(FileData file)
If file is a text file, returns the contents of that text file as a string.

String GetFileName(FileData file)
Returns the file name of the file associated with the given file data object.

String GetFileContentType(FileData file)
Returns the content type associated with the given file data object.

NoReturn SetFileName(FileData file, String name)
Sets the filename of the given file data object.

NoReturn SetFileContentType(FileData file, String contentType)
Sets the content type of the given file data object.

String FileLink(Path path)
Returns a URL that provides a link to download the file in the given path. The last field of the path must be the file field.


Next Topic:
v4.2.0.956 (beta)
Up Since 2/29/2024 12:02:23 AM