PDA

View Full Version : SPPID Automation - PlantItemGroups question.



DimitryAT
04-28-2011, 05:15 AM
Hello colleagues,

I have some question related to PlantItemGroup functionality of SPPID and LLAMA.

As I understand, documented method to associate the PlantItem to the PlantItemGroup is to use following code (as example for Instrument):

' Associate the Instrument to the Instrument Loop
instrument.PlantItemGroups.Add instloop.AsLMPlantItemGroup

I try to use it with TestSystems:

item.PlantItemGroups.Add objSystem.AsLMPlantItemGroup

But this is not working for me; what can be the reason?
My code is:



Set items = New Llama.LMPlantItems
items.Collect ds, , , objFilter

Debug.Print "Items belong to Package", items.Count

'updating all items with new system
Set objSystem = ds.GetSystem(system_id)
Debug.Print "Get system: ", objSystem.ItemTag, objSystem.id

'items is Dim items As LMPlantItems, collected by filter

Dim item As Llama.LMPlantItem
Dim pig As Llama.LMPlantItemGroup

items.LoadPlantItemGroups 'for speed
ds.BeginTransaction

For Each item In items

item.PlantItemGroups.Add objSystem.AsLMPlantItemGroup
item.Commit

Next
ds.CommitTransaction

Paulo
05-09-2011, 07:55 AM
which value Are you using on "system_id"?