Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ASandu1637236092
Contributor
Contributor

Validation of data posted

Hello,

I am working with Talend I have received the task to make a route

This route should take data from an api and put the result on a queue .

I have issues with the request to have 2 validations of data posted on api

  • one of them is to have only digits and commas in string posted and
  • the second is to have at most 200 numbers (ex: 123,34,35,780,01, ..... to have no more than 200 numbers between commas

A collegue suggest to use regular expresions and I found this expresion ^[0-9]+(,[0-9]+)*$ for doing the first demand but I do not know how to use it in my route .

I use cREST and I do not know where to put this expresion for doing validation.

Can you help me?

Thanks,

Aurel

Labels (2)
2 Replies
Anonymous
Not applicable

If you want to carry out complicated manipulations of data inside a Route, you can make use of a Talend Job with a cTalendJob component. This will allow you to build a Talend Job and have it used inside the Route. This documentation talks you through a basic example....

 

https://help.talend.com/r/en-US/8.0/route/ctalendjob-standard-properties

ann-gaelle
Contributor III
Contributor III

Hi, As said before the job is the easiest way to manipulate data. If you want to do it inside the route, you can filter message inside a route with "cMessageFilter". So if you message must only have comma and number, you could use Simple language to do it inside the component cMessageFilter. It will be something like "${in.body} !regex [^\d,]" if it matches it means that you don't have something else than number and comma. I didn't test the solution, it's just an insight.

 

For the second maybe trying a split and count in simple ? And then do on it a less than ?

 

You have all the documentation for simple languages here :

https://camel.apache.org/components/3.18.x/languages/simple-language.html

 

And here how cMessageFilter works :

https://help.talend.com/r/en-US/8.0/filter/cmessagefilter-standard-properties

 

Have a nice day and good luck ,