Add a comma between fileds in pipeline rule

Hi,

I have this simple rule, I would to add a comma between these two fields (cs7_latitude and cs8_longitude) but it doesn’t work, there’s an escape char to use or other methods ?

rule “GPS”
when
has_field(“cs7_latitude”) && has_field(“cs8_longitude”)
then
let GPS = concat(to_string($message.cs7_latitude, " , "),to_string($message.cs8_longitude));
set_field(“ip_coordinates”, GPS);
end

Any help is appreciated !

There is likely a better way but does something akin to the below work?

rule “GPS”

when
has_field("cs7_latitude") && has_field("cs8_longitude")
then
let latitude_comma = concat(to_string($message.cs7_latitude), ",");
let GPS = concat(latitude_comma,to_string($message.cs8_longitude));
set_field("ip_coordinates", GPS);
end
3 Likes

Hey, thanks, it worked perfectly !

2 Likes