Copy link to clipboard
Copied
I'm trying to add a second Variable to make the date M/yy. I have something like it below but when i Click on Define Text Variable to double check it it is a Custom Text and not Modification Date. My main fear is that it will not automatically update the Date. If this will Keep updating the Date let me know and i'll just leave it as is. Also if there is a cleaner way to do let me know. Thank you.
tvLn = doc.textVariables.item("L#");
!tvLn.isValid && tvLn = doc.textVariables.add({name:"L#", variableType:VariableTypes.CUSTOM_TEXT_TYPE});
tvLn.variableOptions.contents = String( getDateString() );
var R1, R2;
myTableMOD.columns[0].contents = columnOneContentsArray;
myTableMOD.columns[1].contents = columnTwoContentsArray;
R1 = cell5OfColumn2insertionPoint1.textVariableInstances.add(LocationOptions.AFTER, cell5OfColumn2insertionPoint1);
R1.associatedTextVariable = doc.textVariables.itemByName("getDateString");
var cell5OfColumn2insertionPoint1 = myTableMOD.columns[1].cells[1].insertionPoints[0];
}
function getDateString() {
var date = new Date();
var month = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
// Handle zero prefix
var formatDate = ("/" + date.getFullYear()).substr(-2);
return month[date.getMonth()] +"/" + formatDate;
}
This just might work if i can edit it correctly. Thank you. I'll mark correct if i get it to work.
Copy link to clipboard
Copied
This might help
Copy link to clipboard
Copied
This just might work if i can edit it correctly. Thank you. I'll mark correct if i get it to work.