Using arrays in Transform Map Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2011 08:06 AM
Hi.
I am working on a CMDB import of software installations. I have one already for computers, and another for software packages, and the cmdb_software_instance table ties them together.
I have a custom field on cmdb_ci_computer for the AD SID of the machine. I have another custom field on software packages for the ID number of the software title. So my import of instances includes the AD SID of the machine and the ID number of the package.
The issue that I have is that the AD SID of the machine is on cmdb_ci_computer instead of cmdb_ci. So using the "Referenced value field name" of the AD SID doesn't work, because it's in the wrong table.
I could make an onBefore script that looks up the AD SID in the computer table and sets the target value. But I have 80,000+ installation records and that number is growing every day. 80K lookups of any table is going to slow down the import in a really big way.
So the question is this: Can I use an onStart script to build arrays of all the computers and their AD SIDs, and then refer to the arrays in the onBefore script so I'm just checking the arrays instead of querying the table over and over? Will an array built in an onStart script be available to the onBefore script, or is it lost when the onStart is completed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2017 08:22 AM
what are the coalesce field that you use for the data import for software installation records? we have 1million + records that we need to import from altiris for software installations but when we are tranforming they are getting updated instead of getting inserted into table. We have softwareguid as coalesce field & not sure if its right coalesce. Could anyone of you suggest on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2022 07:36 AM
Thanks for the information, Dominik. Your response set me on the right path!
In San Diego release, I've confirmed that a variable declared outside of the function in the onStart template is global and available to scripts throughout the transform.
Below is a simple proof of concept from my PDI.
onStart script creates the global var:
Serial number source script updates and embeds the value:
Resulting records: