inventory reporting with property data
What are you all doing to get clean inventory reports with consistent property value data? When creating inventory reports it can be a challenge to populate them with the desired property data due to the varying names, e.g. auto.productserial, auto.endpoint.serial_number, the data may be found under. The solution to add them all and edit the csv afterwards is clunky.
pperreault
Posted 4 years ago·Last reply 4 years ago
4 comments
pperreault
OP4 years agoThis worked perfectly, thanks.
LM User
·4 years agoMakes sense, would be a matter of your logic defining inheritance priority. So if both auto.productserial and auto.serial_number both exist, which one should be unified.serial_number?
Obviously the first step would be to check the existence of any of the properties that would feed in. If only one exists, that becomes the unified value.
If more than one exists, check that the values are not null (you can have a property that exists without a value). If only one has a value, that one becomes the unified value.
Of the ones that exists, that have non-zero length values, you'd have to decide which one would take priority. This could be simple or complex, depending on how fancy you want to get.
Something simple might look like this:
You don't necessarily need to do the second println statement, but i find it handy in this kind of situation to record a property telling you which property won the priority contest. You may notice that this actually prints out all of them. That's true. But LM only pays attention to the last value of any duplicate property lines. In my case, with fake values for serial_number and productserial (and the other two are null in my case), the output looks like this:
If you test this from the PS screen, you'll see that the last two lines overwrite the first two. That's why the order of the very first list is important. The last, existent, not null property value will be the one that goes into the unified property.
pperreault
OP4 years agoI thought of that possibility, haven't chased it down yet. What I don' t want is a list of the values from all the possible properties, which unless there is logic to remove repeat values, this might result in.
LM User
·4 years agoGut reaction is why not make a property source that consolidates those properties into a unified set of properties (unified.serial_number, for example). Haven't really thought it through, just an idea.