Main Web API Documentation Information
Actual Page/Function Name:
getSubInventoryById
Human Readable Name or Caption:
Get Sub Inventory By ID
Page/Function Description:
This method gets a single package or piece of sub inventory by the id number.
Page/Function Output Type:
API - JSON or WDDX
Categories:
parts
Extra Page/Function Notes:


Parameters
Scope Name Type Default Description Required Alternates Known Values
Arguments CORP_ID Numeric 0 Pass in the corp id number. Yes
Arguments PART_ID Numeric 0 Pass in the parent part id number if known. If unknown, use a 0. Yes
Arguments SUB_INVENTORY_ID String 0 Pass in the sub inventory id number or a list of sub inventory id numbers. Yes


Results
RET_STATUS RET_MAIN_MESSAGE RET_SECOND_MESSAGE Redirect Link Description
ok success This indicates a valid response. There are a number of possible sub arrays that will also be passed back. More information is listed below.
Name Type Description Notes
QRY_SUB_INVENTORY_ATTRIBUTES_ARRAY Array These are the sub attribute columns (dynamic per corporation and per part/item category). AKA - the extra data points. This array has some fairly deep database fields that are stored per sub attribute. Some of them may not be needed. As a side note, there are three main types of sub attributes. They are dates, text or strings, and numeric data fields (different data types). The sub attributes are virtually the custom data points that are stored per part/item category. Here is a list of values passed back in this array:

- ATTRIBUTE_COLUMN - This value is an alphanumeric value that helps us see if the attribute is a number, a date, or a text value. For example: n1 would be a numeric value in the column number 1 place. So, a n5 would be a numeric value in the fifth column. Other values may be something like t1, t7, d1, d10, etc. Each letter/number combo represents a data type and column number. The only text values are n, t, d, and then some other numeric column number.

- ATTRIBUTE_HIDE - This will be a 1 or a 0. It deals with whether or not to show the sub attribute on the invoice (customer receipt). 0=show, 1=hide. Once again, this only deals with show/hide options on the physical invoice or customer receipt.

- ATTRIBUTE_NAME - This is the human readable sub attribute name.

- ATTRIBUTE_REQUIRED - This will be a 1 or a 0. The default is a 0 or don't require the user to input the data. If set to a 1, the sub attribute will be required when first adding in the new sub or child package.

- ATTRIBUTE_SORT - This will be a numeric value or a manual sort order. The default is 100. Basically, we sort all of the sub attributes based off of this manual numeric sort field and then off the auto id number. This is how a user may be able to alter the sort order of where a certain sub attribute shows up.

- ATTRIBUTE_STATUS - This will be a 1 or a 0. A 1 means that the sub attribute is active (use/show). A 0 means that the attribute is inactive (un-used/hidden).

- ATTRIBUTE_TYPE - This will be a string of date, number, text, or select. Both text and select point to the same table. The main difference deals with the way data is added. The text option means an open entry field (basic text input). The select option means that a preset list has been added (a drop-down list or form option) and the user is able to select an option from the choices provided.

- ATTRIBUTE_VALUES - These are the defaults that get setup per attribute. If there is a list of options, they will have the pipe symbol (|) to separate those values. The default is a blank string.

- COLUMN_NUMBER - This is a numeric value and shows what column is associated with the values that get stored. Without getting super technical, we have three different data types (text, numeric, and dates). Each section restarts the numbering at 1 and goes up from there per part/item category. What this means is that you could have a T1 (text number 1), a D1 (date number 1), and an N1 (numeric number 1). This column number is used inside the database to make sure that stored values get associated with the correct sub attribute column.

- CORP_ID - This is the corporation id (company id or world id number) number.

- DATA_TYPE_TABLE - This will be one of three main database table names. Valid options are: custom_dates, customer_text, and custom_numerics. Behind the scenes, these values make sure that we store the associated values in the correct sub tables based off of the column numbers and data types.

- LABEL_POSITION - This deals with a named position on labels. Valid options are: a blank string, top, middle, bottomLeft, and bottomRight.

- PART_CATEGORY_ID - This is the part/item category id number. All sub attributes are setup based off of a single part category id. In a way, you could say that sub attributes are a virtual database extension (additional data points) per part category.

- SUB_INVENTORY_ATTRIBUTE_ID - This is the auto id number for the sub attribute.

- WEB_SEARCH_BY_ATTRIBUTE - This will either be a 1 or a 0. The default is a 0 or turned off. This field mostly deals with an internal ecommerce or web presence setting. Basically, do you want to be able to search by this sub attribute out on the web (yes/no).

- WEB_SHOW_ATTRIBUTE - This will either be a 1 or a 0. The default is a 0 or turned off. If the value is set to a 1, the sub attribute will show up on the web for the public to see. Some attributes may contain sensitive information and/or internal information. This show/hide options allows you to control that behavior out in the public web or ecommerce area.

- WEB_SORT_BY_ATTRIBUTE - This will either be a 1 or a 0. The default is a 0 or turned off. Once again, this is an internal web/ecommerce setting that helps us with displaying sub or child packages and their sub attributes out on the web.
QRY_SUB_INVENTORY_BY_ID_ARRAY Array This array holds the main information for the sub or child package or sub inventory item. The results are a small data dump based on the sub inventory id. Not all data is needed, but it is provided just in case you do need it. Each array value will have an object with the following values.

- CORP_ID - This is the corporation id number.

- INVOICE_NUMBER - This is the invoice number assigned to the transaction. If the invoice number is a 0, that means that the sub inventory or child package must have had some activity on a PO (purchase order or production order). If the invoice number is a real number, then the current transaction took place and an item was sold and/or included on an outbound invoice.

- PART_ID - This is the main part id number (auto id per item or per part). This is how the sub or child inventory package is associated with the parent part/item. This value will match the parent item's id number.

- PART_NUMBER - Similar to the part id number, this is the parent part/item's human readable part number. This could be any alphanumeric string. Even though it says number, it is technically a string. For example: A valid part number may be "Snickers" or "Butterfingers" or "ABC-1234"

- PO_INVOICE_LINE_ID - This is a numeric value that is used internally to associate a sub inventory package or child package with a specific PO/Invoice line item id number (auto id for another table - foreign key). This id is usually tied to the PO where the sub inventory package was created and/or first recorded. If the INVOICE_NUMBER field is a real value, this PO_INVOICE_LINE_ID will represent a line item number on an invoice instead of a PO.

- PO_NUMBER - This is usually the PO number where the sub or child package came into existence. If this number is a 0, then there should be a valid number in the INVOICE_NUMBER field. As a side note, this table shares info between inbound and outbound transactions. Most times, a PO is the inbound and invoices are the outbound. There are two types of PO's that remove items as well. One is an inventory adjustment PO (updating counts and quantities) and an internal build PO (grabbing or using raw goods to make and/or create something new - mini manufacturing).

- RUNNING_SUB_QUANTITY - This is the running quantity or real quantity that is available. The SUB_QUANTITY value is the transaction quantity. Depending on what transaction is being looked up, that number (the transaction quantity) may be positive or negative. For example, when it starts, say it is at 200. The running quantity may be at a value of 110 or some other number.

- SPECIAL_DESCRIPTION - The sub description may be set on a per sub or per package basis. It is ok for the sub description to be different then the main parent item description. Sometimes they are the same, sometimes they are different, depending on the situation.

- STORE_ID - This is the store/location id number. The store/location id is recorded per transaction. Often things start in one location and then either get used and/or transferred to a different location.

- SUB_BAR_CODE - This is a sub barcode that may be set by the corporation on a per sub or per child package level. Usually an alphanumeric string of some sort or another.

- SUB_COST - This is the sub cost for the specific package. Often the cost is left hidden unless trying to add an item to a quote, order, or invoice. Each sub and/or child package has their own sub cost. The parent item holds a single general cost called part_cost. If using subs, make sure and use the correct sub cost.

- SUB_DISABLED - The sub disabled field is a numeric value. The name may be a little bit misleading. Think of it as availability vs disabled. Here are the values: 0=open/use/show (open and ready for use), 1=open/greyed out/disabled (exists but sub or child package has not yet been open), and 2=closed/hide (done - no more quantity). The most common values are 0 and 1.

- SUB_INVENTORY_DATE - This is usually the initial or creation date of the sub package. We also track the dates of all other transactions against this package. Depending on what sub id you are asking for, this date may be a transaction date instead of a creation date. One good way to know if you are seeing the creation date or just another transaction date is the sub inventory id and the sub reference id numbers. If they are the same number, you are looking at the creation date. If those two numbers are different, you are looking at a transaction date.

- SUB_INVENTORY_ID - This is an auto id number that gets assigned behind the scenes per sub package. This method will pull data based on this sub inventory id number. Please note that the sub inventory id number is a key field and will auto generate the next id. That is true for new packages as well as transactions against existing packages. We recommend that most of your interactions use a number called the SUB_REFERENCE_ID. When the sub package is created, the sub inventory id and the sub reference id will match. Once the package starts getting used, the sub inventory id will keep auto numbering but the sub reference id will remain the same. Long story made short, even though this is the primary key, we highly recommend using the sub reference id as that will keep the packages tied together as it gets used, sold, and/or distributed in one way or another.

- SUB_INVENTORY_STATUS - This will be a 1 or a 0. The default is a 1 or live/active. If set to a 0, the sub inventory or child package is considered inactive or virtually dead.

- SUB_PRICE - Each package has a possible list price. The pricing can be tricky... There are options for parent pricing, special web pricing, advanced pricing tiers, etc. This is just a set price per package but other options may be used as needed. This of this as a starting place per package.

- SUB_QUANTITY - Normally, this would value would be the quantity on hand for a single sub package. However, because we allow you to pull data based on a single sub inventory id number, this number may be the transaction quantity amount. For example: say you asked for a sub inventory id that was the package creation. It may show a value of 50, even through 35 of the items have been sold. Most other method will calculate the totals and sum up the quantity. This method returns the transaction amount. If you happen to ask for an invoice transaction, this quantity may be negative and shows the outbound values. Inside the main adilas system, there are a number of protecting conditions that should block any overselling or overusing of a single sub or child package. Once that data is being processed outside, through the API socket, we need you as a developer to help monitor and keep track of things. A new fields called RUNNING_SUB_QUANTITY was added to help see what the running or cumulative sum of the quantity is to date. Use that value if you are checking for quantity that is available for use.

- SUB_REFERENCE_ID - This is virtually the sub package or child id number. Technically, the original package gets its id from an auto numbering system, but once created, this sub reference id number is how a single package is tracked through the system. If needed, see the SUB_INVENTORY_ID field above for more information.

- SUB_RFID_TAG_NUMBER - Each sub or child package has its own sub RFID tag number. This is an optional field, but may be very important if really tracking full traceability and/or if reporting to some other outside or 3rd party tracking system. Often the sub RFID tag is the key to keeping inventories, in multiple systems straight. As a reference, the parent item has a field called rfid_tag_number that exists on the higher or parent level. It is totally allowed and common that the parent and the sub RFID tags are different.

- SUB_UNIT_OF_MEASURE_ID - This will be a numeric value. Here are some commonly used id's: 1=each, 2=inches, 3=feet, 4=yards, 5=centimeters, 6=meters, 7=millimeters, 8=cups, 9=pints, 10=quarts, 11=gallons, 12=fluid ounces, 13=ounces, 14=pounds, 15=grams, 16=kilograms, 17=milligrams, 18=liters, 19=hours, 20=minutes, 21=days, 22=hundredweight, 23=teaspoons, 24=tablespoons, 25=tons, 26=per 10, 27=per 100, 28=per 1,000, 29=per piece, 30=milliliters, 31=blank. There may also be others that custom and/or corporation specific.

- TIME_ID - This is a numeric value. The default is 0. If other than 0, the sub inventory or child package is tied to an element of time (robust calendar and scheduling object inside of adilas). If yes, there may be a number of other key pieces of information, phases, sub locations, processes, groupings, etc. that may exist on the element of time. This id number may be used in other look-ups to get additional information.

- VENDOR_PAYEE_ID - This is the parent vendor id number for the main parent part/item. Each sub package (sub inventory record) will hold hands with the parent vendor to help with searching, filtering, and quick look-ups.
QRY_SUB_INVENTORY_TEMPLATE_ARRAY Array These are some basic part/item category level values that may be useful. This is a short list (not the full database table schema) and mostly help with a web name and a possible web category description. Even though this is an array, it usually only has one object being passed back. The information being passed back is:

- SUB_TEMPLATE_DESCRIPTION - This is a web description of the part/item category.

- SUB_TEMPLATE_LOCKED - This will either be a 1 or a 0. The default is a 0 or turned off. This is an older field that helped us lock the settings in place. If the part category is unlocked, additional edits were allowed. If set to a 1 (locked), the system wouldn't allow edits unless it was unlocked again. Somewhat of an older field.

- SUB_TEMPLATE_NAME - This is the name of the category. The sub template name and the main part/item category name are often the same. We do allow things to slightly differ, but usually they are the same. For this method, this is the only name that is returned.

- USE_SUB_INVENTORY - This will either be a 1 or a 0. The default is a 0 or turned off. If the value is set to a 1, in theory, there should be at least 1 sub attribute (a date field, a text field, or a numeric field). Originally, this field helped us figure out which category level needed additional logic and attention. Still used, but not as important as it once was.
dataIn Unable to look-up sub inventory. Missing some data. Use your back button and try again. You will get this message if the inbound values do not meet the minimum criteria.
db Something went wrong with the sub inventory look ups. Unable to proceed. Use your back button and try again. This message is a global catch for the method. If something happens mid stream in the process, you may get this message.


Samples
Caption Text
JSON
{"API_URL_ENCODING":"AUTO","API_CURRENT_PAYEE_ID":3,"API_CORP_KEY_ID":"PLA-0053","API_USER_PASSWORD":1234,"CORP_ID":53,"API_CALL_FUNCTION_NAME":"getSubInventoryById","PART_ID":225446,"API_INPUT_OUTPUT_TYPE":"JSON","SUB_INVENTORY_ID":58,"API_USER_NAME":"demo"}
Sample response with a copule of values
{"QRY_SUB_INVENTORY_BY_ID_ARRAY":[{"SUB_QUANTITY":200.00000,"SUB_COST":0.50000,"SUB_RFID_TAG_NUMBER":"","INVOICE_NUMBER":0,"CORP_ID":53,"PART_ID":233903,"SPECIAL_DESCRIPTION":"Movie gum drops","SUB_INVENTORY_DATE":"2019-06-17","PART_NUMBER":"Dots","PO_INVOICE_LINE_ID":954,"PO_NUMBER":42,"SUB_UNIT_OF_MEASURE_ID":1,"SUB_DISABLED":0,"SUB_PRICE":0.85000,"SUB_REFERENCE_ID":2,"TIME_ID":0,"SUB_INVENTORY_ID":2,"RUNNING_SUB_QUANTITY":170.00000,"STORE_ID":178,"SUB_ATTRIBUTES":[{"ATTRIBUTE_NAME":"Count Per","ATTRIBUTE_TYPE":"number","ATTRIBUTE_COLUMN":1,"ATTRIBUTE_ID":1,"ATTRIBUTE_VALUE":1.00000},{"ATTRIBUTE_NAME":"Extras","ATTRIBUTE_TYPE":"text","ATTRIBUTE_COLUMN":1,"ATTRIBUTE_ID":2,"ATTRIBUTE_VALUE":"Blue"},{"ATTRIBUTE_NAME":"Holiday","ATTRIBUTE_TYPE":"select","ATTRIBUTE_COLUMN":2,"ATTRIBUTE_ID":3,"ATTRIBUTE_VALUE":"Easter"},{"ATTRIBUTE_NAME":"Best By Date","ATTRIBUTE_TYPE":"date","ATTRIBUTE_COLUMN":1,"ATTRIBUTE_ID":4,"ATTRIBUTE_VALUE":""}],"SUB_INVENTORY_STATUS":1,"SUB_BAR_CODE":"b-2","VENDOR_PAYEE_ID":28591}],"RET_SECOND_MESSAGE":"","QRY_SUB_INVENTORY_ATTRIBUTES_ARRAY":[{"ATTRIBUTE_REQUIRED":0,"ATTRIBUTE_TYPE":"number","COLUMN_NUMBER":1,"DATA_TYPE_TABLE":"custom_numerics","ATTRIBUTE_STATUS":1,"CORP_ID":53,"WEB_SEARCH_BY_ATTRIBUTE":0,"LABEL_POSITION":"","PART_CATEGORY_ID":2741,"ATTRIBUTE_VALUES":"1","ATTRIBUTE_NAME":"Count Per","SUB_INVENTORY_ATTRIBUTE_ID":1,"ATTRIBUTE_COLUMN":"n1","WEB_SHOW_ATTRIBUTE":1,"WEB_SORT_BY_ATTRIBUTE":0,"ATTRIBUTE_SORT":100,"ATTRIBUTE_HIDE":0},{"ATTRIBUTE_REQUIRED":0,"ATTRIBUTE_TYPE":"text","COLUMN_NUMBER":1,"DATA_TYPE_TABLE":"custom_text","ATTRIBUTE_STATUS":1,"CORP_ID":53,"WEB_SEARCH_BY_ATTRIBUTE":0,"LABEL_POSITION":"","PART_CATEGORY_ID":2741,"ATTRIBUTE_VALUES":"","ATTRIBUTE_NAME":"Extras","SUB_INVENTORY_ATTRIBUTE_ID":2,"ATTRIBUTE_COLUMN":"t1","WEB_SHOW_ATTRIBUTE":1,"WEB_SORT_BY_ATTRIBUTE":0,"ATTRIBUTE_SORT":100,"ATTRIBUTE_HIDE":0},{"ATTRIBUTE_REQUIRED":0,"ATTRIBUTE_TYPE":"select","COLUMN_NUMBER":2,"DATA_TYPE_TABLE":"custom_text","ATTRIBUTE_STATUS":1,"CORP_ID":53,"WEB_SEARCH_BY_ATTRIBUTE":0,"LABEL_POSITION":"","PART_CATEGORY_ID":2741,"ATTRIBUTE_VALUES":"Christmas|Halloween|Easter|Thanksgiving|4th of July|Other","ATTRIBUTE_NAME":"Holiday","SUB_INVENTORY_ATTRIBUTE_ID":3,"ATTRIBUTE_COLUMN":"t2","WEB_SHOW_ATTRIBUTE":1,"WEB_SORT_BY_ATTRIBUTE":0,"ATTRIBUTE_SORT":100,"ATTRIBUTE_HIDE":0},{"ATTRIBUTE_REQUIRED":0,"ATTRIBUTE_TYPE":"date","COLUMN_NUMBER":1,"DATA_TYPE_TABLE":"custom_dates","ATTRIBUTE_STATUS":1,"CORP_ID":53,"WEB_SEARCH_BY_ATTRIBUTE":0,"LABEL_POSITION":"","PART_CATEGORY_ID":2741,"ATTRIBUTE_VALUES":"","ATTRIBUTE_NAME":"Best By Date","SUB_INVENTORY_ATTRIBUTE_ID":4,"ATTRIBUTE_COLUMN":"d1","WEB_SHOW_ATTRIBUTE":1,"WEB_SORT_BY_ATTRIBUTE":0,"ATTRIBUTE_SORT":100,"ATTRIBUTE_HIDE":0}],"QRY_SUB_INVENTORY_TEMPLATE_ARRAY":[{"SUB_TEMPLATE_DESCRIPTION":"This category will be used for Candy.","SUB_TEMPLATE_NAME":"Candy","SUB_TEMPLATE_LOCKED":0,"USE_SUB_INVENTORY":1}],"RET_STATUS":"ok","RET_MAIN_MESSAGE":"success","RET_TYPE":"success"}
Outside Links
If you want to see this JSON response in a more readable format - we recommend copying the JSON portion into something like https://jsonlint.com/ and then reading it from there. Also, some of the output may look pretty intense due to normal URL encoding. We often have to flatten certain strings to send them over the web (spaces, special characters, etc.). If you need a visual URL decoder page, see the following small adilas tool for URL encoding - https://www.adilas.biz/web/url_encoder.cfm (this tool goes from web URL encoding back to normal English - back and forth).