Write to different tables in transform map

tpoeckes
Giga Guru

I have one import set table defined that will hold data for three (3) different classes: 1.) cmdb_ci_ip_firewall,   2) cmdb_ci_ip_router,   3.) cmdb_ci_ip_switch.   In the import table, there is a class field that tells me what class the data needs to written to.   The three classes will have two (2) attributes: 1.) sys_id and 2.) os_version.   In the transform map, do I need to defined three (3) different maps, or is there a way that I could scripted it to updated the three classes depending on what class record I'm processing?

1 ACCEPTED SOLUTION

Michael Fry1
Kilo Patron

You can definitely script it. If you look at the out of the box Computer one, it gives you idea how to do it:


if (source.operating_system == "AIX" ||


      source.operating_system == "HP/UX" )


  target.sys_class_name = "cmdb_ci_unix_server";



if (source.operating_system == "Windows 2000 Server")


  target.sys_class_name = "cmdb_ci_win_server";



basically it's


if (source.field-name-from-spreadsheet == "value here") < - - - from spreadsheet, column heading could be Class and choices are Firewall, IP Router, etc


  target.sys_class_name = "cmdb_ci_win_server"; < - -   this is table to insert into.


View solution in original post

5 REPLIES 5

Hi - can you share some more details on how you did this? How did you map each of the fields in the different classes from the source to those different target fields? Was that all in the script too?