cancel
Showing results for 
Search instead for 
Did you mean: 

TryGetValue property array

Mark_Rogers4
Champ in-the-making
Champ in-the-making

 I am having trouble bringing in a property that contains multiple instances of a keyword.  The "Set property to all keyword value instances" checkbox is checked.  They keyword is defined as "Numeric (Up to 20 Digits)".

In my code I have this:

System.Int32[] expID2;

bool sourceFound = propertyBag.TryGetValue("propExposureID", out expID2);

I get this:

Task list execution failed: Unexpected error: Type is not the requested Type: System.Int32

I also tried using Int[], short[], and long[], but it still fails.

What am I doing wrong?

9 REPLIES 9

Rob_Herman
Star Contributor
Star Contributor

Good afternoon,

20-digit numeric values use the decimal type (since they won't fit into even a 64-bit integer), so please try using a decimal[].

[quote user="Rob Herman"]

Good afternoon,

20-digit numeric values use the decimal type (since they won't fit into even a 64-bit integer), so please try using a decimal[].

Hi Rob,

Is there table that maps Keyword Value Types to the preferred data type?  We are planning to update a Hyland.Services based library to Unity and some data validation would be useful before allowing other systems to upload documents with keywords.  This information would be extremely helpful for this upgrade project.

Thanks!

Tharon_Rivera
Star Collaborator
Star Collaborator

This may not make complete sense, but I would try to retrieve as a string array.  Even though the keyword type is Numeric, there isn't really a way to set the Property type and usually string works and I will convert/parse to other types as needed.

If you are running against a single document, you could also just retrieve the keyword values directly from the document instead of using a property bag.

Rob_Herman
Star Contributor
Star Contributor

Good afternoon Tharon,

In the SDK, in Home / Programmer Guide / Documents and Keywords / Working with Keywords / Accessing Keywords in Keyword Records topic, there is a code sample that demonstrates the appropriate .NET data type for each Keyword Type data type.

In brief: Alphanumeric keywords use string; Currency, Specific Currency, and Numeric 20 keywords use decimal; Date and Date/Time keywords use DateTime; Floating Point keywords use double; and Numeric 9 keywords use long.


Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.