I am trying to create an automatic replacement of fields from a letter template, but i get stuck when the field is a date.
If there is a way of checking to see if the dataprovider is a date and then doing a conversion to text, it would be very neat.
I thought i had cracked it when i found the .getTypeAsString() function, but maybe i am using it wrongly.
you cannot say dataprovider.getTypeAsString()
- Code: Select all
var fields=forms.LETTER_TEMPLATE.alldataproviders
for ( var i = 0 ; i < fields.length ; i++ )
{
if (utils.stringPatternCount(globals.letter_edit, '<<'+fields[i]+'>>')>0){
--> Want to check the type of field that fields[i] is here so i can change it to text if it is a date<--
globals.letter_edit=globals.letter_edit.replace('<<'+fields[i]+'>>', forms.LETTER_TEMPLATE[fields[i]])
}
}
Thanks for telling me where i am being stupid!
David