Best Way to Run Multiple Transform Maps off one Import Table

anfield
Tera Guru

I will be connecting an integration to an external system where CI data will be fed into servicenow. I'm thinking of pushing this data to one import table and connecting multiple transform maps where each one would only fire and process if the device is a certain type. What would be the best way to do that? For example if the field on the import table has u_category != 'AirConditioning' then ignore = true otherwise run this transform map. Each transform map would be similar., in that it would process only if it matches a specific CI category.

Would it best best to put this in the OnStart script in each transform map? Obviously id want this to work in the most efficient way possible, Thanks

Considering the above design. Otherwise I would have around 10-15 import tables for all the device types that I need to import

 

11 REPLIES 11

Michael Jones -
Giga Sage

It sounds like you have the right approach. You would create your import table and associate as many transform maps as you need. Then, in your onstart script for each transform map check for the value that indicates that you want to execute that map and, if not found, set ignore = true to skip that map. 

This assumes they are sending batches where only one transform map would apply to the batch.

If they are sending a mixed bag (different rows in the same batch need different transform maps) then I think you'd need to do your check in an onBefore script so that each individual row is skipped, or not, based on your matching values...

Hope this helps!

If this was helpful or correct, please be kind and click appropriately!

Michael Jones - Proud member of the CloudPires Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Thanks. I think there will be a mixed bag of different devices types sent all at once basically.

It looks like for every record imported into the import table it will create a record for each transform map. Is that correct? For example it will show the record that is processed to the correct table, but then it shows another record for the other transform map - and it has that line as ignored. Is there any easy way around that?

 

I could maybe run a script delete for this. Just wondering if there is an easier, more out of box way to handle this. When inspecting the import table data after data loads, it could be inconvenient to have to sort through this.

If you use an onBefore script in each transform map, you can evaluate each line of the import and set ignore if it doesn't match that transformation. If a line only passes one onBefore script, you should only end up with 1 record per line. 

Say you have 3 transform maps. You have a line in your payload that has a field named "hardware_model" with a value of "Dell X31"

In your onBefore script you'd have something like

if(source.hardware_type != "HP Q230") {
ignore = false;
}

The line would be skipped as the hardware_type is "Dell X31". No record would be created. 

But if you had this:

if(source.hardware_type != "Dell X31") {
ignore = false;
}

The line would be processed and a record would be created. 

Make sense?

If this was helpful or correct, please be kind and click appropriately!

Michael Jones - Proud member of the CloudPires Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!