I've been pulling my hair out over this for half the weekend
My ultimate objective is to read a date stored in a text file and display it in a text field on my PDF page.
However, I am currently stuck at the point of simply importing the pure text (without reformatting it to the date format I would ultimately like).
The text contained in my text file is simply a list of dates (of which I wish to print the first in the list). Read about the importTextdata function I have added a header line with the text fields name - so the contents of my text file looks like this:
LastSyncDate
09/10/2012 12:17:53.54
04/10/2012 14:23:45.32
23/07/2012 12:46:35.51
Never
I understand that the importTextData command is a priveleged function so I have written a folder level script to read the text file and store the text in a variable, which is then assigned to the text field.
I have then called the trusted function at the Document Script level of the page concerned:
Folder Level script:
LastSyncCalc3 = app.trustedFunction( function()
{
app.beginPriv();
var LastSync3 = importTextData("/C/sync/bin/LastSyncTest.txt", 0);
this.getField("LastSyncDate").value = Lastsync3;
app.endPriv();
}
);
Document Level Script:
LastSyncCalc3();
Running this gives the following errors in the console:
importTextData is not defined
4:Document-Level:SyncDate
ReferenceError: importTextData is not defined
4:Document-Level:SyncDate
Thinking I had my commands misplaced, I changed the folder level script and document level script to the following:
Folder Level script:
LastSyncCalc3 = app.trustedFunction( function()
{
app.beginPriv();
var LastSync3 = importTextData("/C/sync/bin/LastSyncTest.txt", 0);
app.endPriv();
}
);
Document Level Script:
this.getField("LastSyncDate").value = Lastsync3;
Running this gives the following errors in the console:
Lastsync3 is not defined
1:Document-Level:SyncDate
ReferenceError: Lastsync3 is not defined
1:Document-Level:SyncDate
Where am I going wrong please ??