Created
June 16, 2021 19:53
-
-
Save cgillis-aras/553d3014bed2514357f13b93181b10f0 to your computer and use it in GitHub Desktop.
Sample code to get all the date properties on a given ItemType.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string itemTypeName = this.getType(); | |
Item dateProps = inn.newItem("Property", "get"); | |
dateProps.setProperty("data_type", "date"); | |
dateProps.setAttribute("select", "name"); | |
Item sourceIT = dateProps.createPropertyItem("source_id", "ItemType", "get"); | |
sourceIT.setProperty("keyed_name", itemTypeName); | |
sourceIT.setAttribute("select", "id"); | |
dateProps = dateProps.apply(); | |
List<string> datePropNames = new List<string>(); | |
for (int i = 0, numProps = dateProps.getItemCount(); i < numProps; i++) | |
{ | |
Item dateProp = dateProps.getItemByIndex(i); | |
string datePropName = dateProp.getProperty("name", ""); | |
if (string.IsNullOrEmpty(datePropName)) | |
{ | |
return inn.newError($"Could not read name for property with ID: { dateProp.getID() }"); | |
} | |
datePropNames.Add(dateProp.getProperty("name")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment