Replace characters in datamapper

Hello !

I have a text file that contains multiple boxes with borders designed with letters and I need to replace them with lines and pipes, but when I do it in workflow it doesn’t work, can I do it directly in datamapper?

for example:
abbbbbbbbbbbbbbbbc
f g
f g
deeeeeeeeeeeeeeeee

to replace:
a,b,d,e = _
f,g = |

Thanks !

It should be feasible in Workflow via a script using Regex.
You can’t just do a characters search and replace unless all the characters that are truly text are uppercase and the ones used as table borders are lowercase.

So you would have to use Regex to search for multiple instance of specific characters like, in your example:

  • more than 1 b
  • a g in between more than 1 b
  • more than 1 k
  • a m in between more than 1 k
  • etc…

That is assuming that the rest of your file and any other files coming in are following the same logic.

That is possibly the strangest question I have ever seen on this forum!

Why do you need to replace those characters? Do you intend to print the file as-is?
Also, when you say it doesn’t work in Workflow, what have you actually tried and do you get any errors?

Don’t get me wrong, this can be achieved easily with 2 instances of the Advanced Search and Replace task (the first one uses the b|d|e|k|m regular expression and replaces it with _, while the second one uses the a|c|f|g|h|i|j|n|f regex and replaces it with |).

But still, I’d like to understand the request a little better…

1 Like

In the mean time, wouldn’t you rather extract the actual data (not the table borders) and create you own table when displaying them in your Template?

Thanks jchamel and Phil, My problem is that the number of tables for each document is variable. Please look at the input file.

In workflow, I go through datamapper, then do the replace (with serach and replace) and then continue with template, job and output but I get the same input format.

Thanks a lot !!!

tc_escta_113023_2337_emPR.txt (32.6 KB)

Hi Phil,

I have designed two sections, one with the cover and another for the content of the second page onwards, the idea of this content is to print it as it is, only changing some of the format in the titles

searchReplace.OL-workflow (14.9 KB)

Based on @Phil comment, that should do it.

Thanks jchamel and Phil,

I made the replacements in workflow but when going to datamapper, it doesnt delete the first row of the file, even though in the datamapper configuration I have selected the option to remove one line:

%!
(newec.jdt) STARTLM%%XGF PAGEBRK
%%XGF (newec.frm) SETFORM

image

but when running the datamapper in Designer (outside of Workflow) it removes the line:

(newec.jdt) STARTLM%%XGF PAGEBRK
%%XGF (newec.frm) SETFORM

Thanks !!

Did you forget to send your DM Configuration to Workflow?

Hi Phil, Yes, I have verified it again…

I see that the Selection/Text is based on bytes (La selección/el texto se basa en bytes) option is ticked.

You probably do not want that option to be selected (unless your data contains double-byte characters)

Also, I have created a sample data mapping configuration with the same type of text, and with the same options, and the first line is removed both in the Designer and in Workflow.

Could you upload your data mapping configuration so we can take a look at it? (make sure that no private data is included in the sample files).

Hi Phil, please see the attached files… I appreciate your help.

Thanks !

TC_EM2.OL-template (12.9 KB) ppwatch.OL-Workflow (20.5 KB) TC_EM2_V2.OL-datamapper (8.7 KB)

The first Search & Replace step in your Workflow replaces newec.frm with NEWEC.FRM:

image

but then your DataMapper looks for an exact match using that word:

image

Just untick the Match case option and it will work just fine.

Hi Phil, thanks for your help.

Now I have another problem, I have already managed to get everything working fine, but the %%XGF PAGEBRK text that I use for pagination comes out as the content of the PDF, do you have any suggestions to solve this?

I attach the files I am using… thanks again!

tc_escta_muestra.zip (87.8 KB)

You can add a handlebar helper:

thanks jchamel, works fine !!!