08-28-2015 09:22 AM
I have this weird problem (at least I think it's weird).
I am trying to insert a "Date & Time" into an Autofill using a Unity Script.
The DateTime object is valid and I even do a "ToString()" on the object and display it in the Diagnostics Console.
The object doesn't fill the keyword when I use it in an "Upload Document" and try to autofill.
I try a string with a DateTime.TryParse and that works.
Then I try to convert the original DateTime to a string and back to a DateTime and that doesn't work.
The string is EXACTLY the same as the DateTime Object ToString()
Below is my code:
public void SetKeywordType (Hyland.Unity.Application app, string name, ExternalAutofillKeysetData data, Hyland.Unity.ExternalAutofillKeysetEventArgs args, DateTime datavalue)
{
try
{
KeywordType descType = args.KeywordTypes.Find(name);
DateTime newDT;
string strDT = datavalue.ToString ("MM/dd/yyyy hh:mm:sstt"); // << this doesn't work
//string strDT = "07/07/2015 03:15:56PM"; // << this works
app.Diagnostics.WriteIf (Diagnostics.DiagnosticsLevel.Verbose, "STR DATETIME : " + strDT);
bool success = DateTime.TryParse (strDT, out newDT);
if (success == true)
{
app.Diagnostics.WriteIf (Diagnostics.DiagnosticsLevel.Verbose, "NEW DATETIME : " + newDT.ToString());
Hyland.Unity.Keyword kw = descType.CreateKeyword(newDT);
app.Diagnostics.WriteIf (Diagnostics.DiagnosticsLevel.Verbose, "kwName = " + kw.KeywordType.Name + " " + kw.DateTimeValue.ToString());
if (kw != null)
{
data.SetKeyword( kw );
}
else
app.Diagnostics.WriteIf (Diagnostics.DiagnosticsLevel.Verbose, "Keyword: " + datavalue + " IS NULL");
}
else
app.Diagnostics.WriteIf (Diagnostics.DiagnosticsLevel.Verbose, "ERROR: Could not Parse Date");
}
catch( Exception ex )
{
app.Diagnostics.Write( ex );
}
}
09-02-2015 12:28 PM
if you read my previous comments you will see that I have been testing my results in both the OnBase Thick Client and the testing area of the AFKS dialog box (OnBase Config) and this was working in neither.
One of my coworkers said: "Does it work in the Unity Client?", so I tried it and it worked!
Every date and time worked in the Unity Client.
With that I called Hyland support because this is now beyond an API question.
Hyland says: ". We do parse date values differently in Unity vs. Thick Client. Unity is able to parse DateTime values, while Thick Client just parses Date values."
Argh!
Mystery solved.
Thanks,
Jed K
08-31-2015 07:39 AM
09-01-2015 12:34 PM
09-01-2015 12:40 PM
09-01-2015 02:41 PM
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.