Character Limit exceeded report

Hi,

I’m wondering if it is possible to create a “report” through workflow, that checks the fields in a .csv and flags if any of the data in certain fields goes over 50 characters?

I’ve got a field set up in my datamapper called “CharacterLimit” that uses a script to check if any fields go over the limit, but I’m just needing to get that field, if it contains anything, to output to a .csv or .txt through workflow, along with say the record number to be able to cross reference.

Or maybe there is a better way to do it?

Any guidance would be much appreciated :slight_smile:

You say you already have in your Datamapper a script that check for overflown fields. Then, in your Workflow, in the Execute Datamapping plugin, set the Output Type to Simplified JSON.

Look at the JSON via a text editor to see what you have and then using Workflow’s Run Script plugin with language set to Enhanced JScript, extract the value from the JSON, store it in a variable and voilà. Next is it only a matter to build whatever report you want.

Thanks for your reply :slight_smile:

I just need a little more help with the second part. I’ve got the JSON, but are you able to give me an example of what the script should be, how to store it as a variable and then how to build the report?

Sorry, I am very new to OL Connect so any help is greatly appreciated :slight_smile:

Hi Laura,

Here is another method that can run with or without Workflow. In the attached CSV Data Mapping config I have a Postprocessor script that writes to a CSV file any records that exceed the 50 character limit. Adjust the Postprocessor script to your desired output.

The Postprocessor script can be viewed by selecting the “Prostprocessor step” (the chequered flag), in the Actions pane you will see a Postprocessor script called ExportToCSV. Make sure the output folder exists at C:\\out

My Extraction contains a field called recordNum that is set to JavaScript using record.index which gives the script the record number of the CSV input data.

Everytime the mapper is run, be it in the designer or Workflow, it will export to a CSV. e.g. Log 19-11-2025.csv

Sample CSV Mapper.OL-datamapper (3.5 KB)

Regards,
S

1 Like

@Sharne 's answer is better! :wink:

1 Like

Thanks so much @Sharne, it sounds like that will be perfect, but I couldn’t open the sample datamapper file, it came up with an error saying “invalid config file”

Hi Laura,

What version of OL Connect are you using? I will need to save the mapper to your version. Let me know and I will reupload it.

(I’m using 2025.1.1)

EDIT:
Here is a 2021.1 version of the data mapper config.
Sample CSV Mapper_2021.1.OL-datamapper (3.6 KB)

Regards,
S

Thanks Sharne,

Sorry for the delay, I could open that new version :slight_smile:

I’m getting an error that says - Cannot read property “length” from undefined.

Is there something I need to change in the script?

Thanks,
Laura

Hi Laura,

Are you running the mapper sample as is and get the error, or did you modify anything? If you are trying to add the script to your own CSV data mapper, then yes the script will need changes to match your CSV fields.

What version of OL Connect are you using by the way?

Regards,
S

Hi Sharne,

I tried to make the same postprocessor script in my own datamap so I might just have to adjust the fields.

I’m using Version 2024.2.1.22757 • Enterprise

I’ll let you know how I go :slight_smile:

Thanks

Hi Sharne,

It’s worked perfectly! Thanks so much for your help :slight_smile: