I have two fields being passed to me. One is a date and the other currency. I am trying to set the data types in the data model and I get the message that the fields are unparseable when I try to set them to date and currency. I should mention that I am also setting the language to German. These are the two fields and the intended format:
38655.460000 format: 38.655,46
2016-10-12T00:00:00 format: 12/Okt/2016
It is interesting to note that the currency field will work if I set it to a data type of float but the thousands separator does not appear.
Many variable might be taken in account in solving your issue. I would recommend opening an online issue so you can send us your Connect template and data in which the error occur.
In the Data format pane at the bottom of the Step properties pane, you have a Date/Time Format field, by default it is set to yyyy-mm-dd hh:nn ap. Remove the trailing so it goes back to yyyy-mm-dd.
Remember that the formats your setting mentioned in the previous paragraph are to tell the Datamapper how to read the value from the data.
Then in your template, using scripts, you can change the format of the data as you see fit. If you look on the internet you will find many function that will allow you to reformat your values.
(sorry, I just realized after posting that there were already answers coming in, but I’m leaving the post as is since it contains explanations for both data formats)
When setting a data type to Date or to Currency, you have to provide additional information about the input format (that’s NOT the ouptut format). In other words, you must tell the DataMapper how to interpret what it reads in order to convert it to a Date or to a Currency format. You provide this information through the Data Format section in the Step properties panel, right underneath the dropdown list for the Type.
For the Currency, make sure you specify the period (.) as your decimal separator and remove any currency sign and thousands separator, since your data doesn’t include any.,
For the Date, make sure the format is set to yyyy-mm-ddThh:mm:ss which is the standard ISO format used in the input file. More information about that ISO format can be found on this Microsoft page.
And for your information, when you are running an evaluation version of PlanetPress Connect, you are entitled to 30 days of support. So you are not simply evaluating the software, you evaluate us too!
Place your field where you want it on the page. It will look something like @fieldName@. You will see that on the left of your screen there is a Scripts pane and under it you newly added field that shows fieldName | @fieldName@. When you select that pair, the actual field on the screen is highlighted in green.
If you double-click, an Edit Script dialog box open which shows you your field and the format selected. You will see at the bottom of that dialog box a button that says Expand.
There you have the script that actually show and format your field. This is where you will put your javascript to change the format of your field accordingly to your need.
Once that is done, when you’ve gone back to the designer main screen, select the Preview tab at the bottom of the page to actually see your field being replace by the value you want.
I guess I will have to take another look at the tutorials. Like I said, javascript is new to me.
I did find this library online that seems to simplify it called moment.js are you familiar with it? How would I use/install an additional javascript library or function for use in designer?
Very easy…simply drag and drop the file containing your javascript onto the JavaScripts folder which is found under the Resources pane of your designer. Make the file as the extension.js.