Skip to main content

Lot Attributes

Reference Materials: Lot Attributes

Lot Attributes​

Lot attributes record facts about one lot that its lot events don't, such as the supplier's lot number, a heat number, an expiry date or a test result. Each attribute is a name and a text value, and a lot can have any number of them.

In Lot Manager, select a lot and open the Lot Attributes tab below the table. Add Lot Attribute, Edit Lot Attribute and Delete Lot Attribute need the Configure Lots permission. The Lot Attribute list offers every name already used on a lot; type a new name to add one. Double-click a row to see its whole value.

Attributes aren't copied to a lot operation's output lots. Check Show Full Lot Attributes to list the attributes of every lot linked to the selected lot, for example a supplier lot number from the shipped package.

Scripts use getLotAttributes, addLotAttribute, updateLotAttribute and deleteLotAttribute.


Overview

A lot is only an ID, a name, an item and a unit, and its lot events give it a quantity, location and state. Real material carries more than that: the supplier's own lot number, a steel heat number, an expiry date, a moisture reading, a certificate of analysis. Lot attributes hold these facts.

A lot attribute is a name and a value attached to one lot. A lot can have as many attributes as you need.

InformationWhere it belongsExample
How much, where, and in what conditionLot events, from lot operations900 lbs at Receiving, OK
True for every lot of an itemItem attributesThe standard shelf life of STD-COAT
True for this lot onlyLot attributesSupplier lot ALC-24-0917

Keep these in mind when you plan lot attributes:

  • Names are free text. There's no list to configure: the first time a name is used, it exists. Supplier Lot and supplier lot # are two different attributes, so agree the names before go-live.
  • Values are text. Write dates as 2027-04-30 and put units in the name, such as Hardness (HRC), so values sort and compare the same way everywhere.
  • Attributes stay on their lot. A lot operation doesn't copy them to its output lots, but you can see the attributes of every lot in a genealogy together.
  • Editing overwrites. An attribute keeps who created it and when, not its earlier values.
  • Deleting a lot deletes its attributes.

Lot Attributes in Lot Manager​

Lot attributes are on the Lot Attributes tab below the lot table in Ops → Lots → Lot Manager. Adding, editing and deleting them needs the Configure Lots permission.

You'll record the supplier's information on the raw materials you received in Execute the Trace, and an inspection result on the coated parts.

Add lot attributes
  1. In Lot Manager, select the aluminum lot (RAL000000000x) and open the Lot Attributes tab.
  2. Click Add Lot Attribute (+). In Lot Attribute, type Supplier Lot, enter the value ALC-24-0917, and click Save.
  3. Add a second attribute to RAL000000000x: Heat Number, H58213.
  4. Select the STD-COAT lot (RBI000000000x) and add Expiry Date, 2027-04-30. The Lot Attribute list now offers Supplier Lot and Heat Number: it lists every name already used on any lot. Choose one to keep names consistent, or type a new one.
  5. Clear Active and click Get lots to reload the table, widening the date range if your lots are older. Select the coated parts lot (WCP000000000x) and add Hardness (HRC), 58.
Edit and view a lot attribute
  1. Select RAL000000000x again. Select the Heat Number row and click Edit Lot Attribute.
  2. Change the value to H58214 and click Save. The table shows who created the attribute and when.
  3. Double-click a row to see its whole value in a popup. That's useful for long values, such as notes or JSON from another system.
See attributes across the genealogy
  1. Select the shipped package (FGP000000000x). Show Full Lot Attributes is selected to start with, so its Lot Attributes tab lists the attributes of every lot linked to the package, with a lot # column: the aluminum's supplier lot and heat number, the coating's expiry date and the parts' hardness.
  2. Clear Show Full Lot Attributes. The tab is now empty: you never added an attribute to the package itself. Select it again before you go on.

This is how attributes answer a customer question such as "which heat of aluminum is in this shipment?" without copying the heat number onto every lot along the way.

tip

Add attributes where the information arrives: the supplier lot at receiving, the hardness at inspection. Don't copy them forward to the output lots; Show Full Lot Attributes and the trace already link them.


Lot Attributes in Scripts​

Most lot attributes come from somewhere other than a person typing them: a receiving screen that scans the supplier's label, a gauge, an ERP or a lab system. Four functions cover them:

FunctionWhat it does
system.kanoa.lot.getLotAttributesReturns attributes filtered by lot, lot name, attribute name or value. Name and value filters are LIKE patterns, so % matches anything
system.kanoa.lot.addLotAttributeAdds an attribute to a lot
system.kanoa.lot.updateLotAttributeChanges an attribute, by its lotAttributeId
system.kanoa.lot.deleteLotAttributeDeletes an attribute, by its lotAttributeId

addLotAttribute always adds a new row, even when the lot already has an attribute with that name. To keep one value per name, look for it first and update it if it's there:

def setLotAttribute(lotId, name, value, userId):
'''Adds the attribute, or updates it when the lot already has one with this name'''
info = {'lotId': lotId, 'lotAttributeName': name, 'lotAttributeValue': str(value)}
existing = system.kanoa.lot.getLotAttributes({'lotId': lotId, 'lotAttributeName': name})
if existing.rowCount:
info['lotAttributeId'] = existing.getValueAt(0, 'lotAttributeId')
return system.kanoa.lot.updateLotAttribute(info, userId)
return system.kanoa.lot.addLotAttribute(info, userId)

Each function returns a value and a message, and the message is None when it worked. Show the message to the user when it isn't.

Write lot attributes from a script
  1. In the Ignition Designer Script Console (Tools → Script Console), get a user ID and the PRM-COAT lot's ID. Replace the x with your lot's number:

    userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
    lotId = system.kanoa.utilities.getFieldValue('lotId', system.kanoa.lot.getLots({'lotName': 'RBI000000000x'}))
  2. Paste setLotAttribute and record the supplier lot: print setLotAttribute(lotId, 'Supplier Lot', 'PC-7731', userId).

  3. Run the same line again with PC-7732. Check the Lot Attributes tab in Lot Manager: the lot has one Supplier Lot, with the new value.

Find lots by attribute

A supplier says its lot ALC-24-0917 was out of spec. Find your lot that came from it, then every lot linked to it:

data = system.kanoa.lot.getLotAttributes({'lotAttributeName': 'Supplier Lot', 'lotAttributeValue': 'ALC-24-0917'})
for row in system.dataset.toPyDataSet(data):
print row['lotName']
trace = system.kanoa.lot.traceLot(row['lotId'], 20)
print sorted(set(r['lotName'] for r in system.dataset.toPyDataSet(trace)))
  1. Run it in the Script Console. It finds your aluminum lot, then lists the lots linked to it.
  2. Compare the list with the aluminum lot's trace graph, at depth D, from Execute the Trace.
In a receiving screen

After executeLotOperation creates the lot, look up its lotId with getLots and write the scanned supplier lot, expiry date and certificate number in the same button press, so a lot never exists without them.

Reference Materials: getLotAttributes

Returns lot attributes filtered by the given parameters


Parameters​

paramsDict Dictionary

- lotAttributeIdInteger
- lotAttributeNameString
- lotAttributeValueString
- lotIdInteger
- lotIdListList of Integers
- lotNameString

Returns​

lotAttributeData pyDataset


Example​

paramsDict = {'lotId': 241}
data = system.kanoa.lot.getLotAttributes(paramsDict)
info = system.kanoa.utilities.convertDatasetRowToJSON(data, 0)
for k,v in info.items():
print '%s: %s'%(k,v)
>>>
createdByUser: jason
lotId: 241
lotAttributeValue: testValue
lotName: AAA
changedDate: None
createdDate: Tue May 27 17:13:28 UTC 2025
createdBy: 5
lotAttributeId: 1
changedBy: None
changedByUser: None
lotAttributeName: testWeight
>>>
Reference Materials: addLotAttribute

Adds a lot attribute


Parameters​

lotAttributeInfo Dictionary

- lotAttributeNameString
- lotAttributeValueString
- lotIdInteger

userId Integer: Id of user executing the function


Returns​

lotAttributeId Integer
message String None if success


Example​

userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
lotAttributeInfo = {
'lotId': 45,
'lotAttributeName': 'testWeight',
'lotAttributeValue': 100
}

lotAttributeId, msg = system.kanoa.lot.addLotAttribute(lotAttributeInfo, userId)
Reference Materials: updateLotAttribute

Updates a lot attribute


Parameters​

lotAttributeInfo Dictionary

- lotAttributeIdInteger
- lotAttributeNameString
- lotAttributeValueString
- lotIdInteger

userId Integer: Id of user executing the function


Returns​

# of records modified Integer
message String None if success


Example​

userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
lotAttributeInfo = {
'lotAttributeId': 1,
'lotId': 241,
'lotAttributeName': 'testWeight',
'lotAttributeValue': 102
}
retVal, msg = system.kanoa.lot.updateLotAttribute(lotAttributeInfo, userId)