How to sync component excluding specific value

Originally asked by Salma Nairi on 07 January 2021 (original question)


Hi All

we have a specific use case :

client wants to sync all value in component expect one specific value

Your help will be appreciate

Thanks


Answer by Salma Nairi on 07 January 2021

Tomás Martynowicz

thanks a lot i tried

replica.components = issue.components.findAll{ component ->
(component.name != "swan)
}  
it works perfectly   
thanks a lot

Answer by Tomás Martynowicz on 07 January 2021

Hi Salma Nairi,

What you can do is to filter the components on the outgoing side, using a script like:

replica.components = issue.components.findAll{ component ->
(component.name == "tr69" || component.name == "wifi")
}

You can also write the same code on Incoming script and filter the components there, depends on your use case. From my perspective filtering should be done on the outgoing script.

Let me know if this helps.

Best Regards


Comments:

Salma Nairi commented on 07 January 2021

thanks a lot

but we haven’t a hole list of component , the client can add more we can’t modify rules every time tha client add new one

i think it will better if

replica.components = issue.components.findAll{ component ->
(component.name != "swan)
}
Tomás Martynowicz commented on 07 January 2021

I see, that will work even better for your use case. I misunderstood that you wanted to filter “wifi” and “tr69” and dump the rest components.

Answer by Salma Nairi on 07 January 2021

Hi Mariia

we suppose that client indicate component= tra69 , wifi, swan

we want to sync only tr69 and wifi only , we exclude swan


Answer by Mariia Onyshchenko on 07 January 2021

Hi Salma Nairi, yes, that sounds doable. Could you please explain the use-case in more detail? What value do they want to exclude?


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.