cancel
Showing results for 
Search instead for 
Did you mean: 

Unity Script to generate Autofill with "Date & Time"

Jed_Kaplowitz
Star Contributor
Star Contributor

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 );
     }
}

1 ACCEPTED ANSWER

Jed_Kaplowitz
Star Contributor
Star Contributor

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

 

View answer in original post

9 REPLIES 9

Jed_Kaplowitz
Star Contributor
Star Contributor

Patrick,
Thanks for the reply.
This is not in any client.  This is in an OnBase Unity Script in C#.
I view the results in two places:
1) In the test are in OnBase Configuration in the Setting dialog for AFKS
2) In the Upload window in the OnBase Think Client.

I think the OnBase Configuration Window though tells the whole story.  I just see two commas instead of a date time between them.

I am convinced this is a bug in OnBase 13.2.258.

Jed_Kaplowitz
Star Contributor
Star Contributor

My final conclusion (which is a little different than my previous conclusion).

This works:
string strDT = "05/07/2015 10:54:04PM";

This doesn't work:
string strDT = "05/07/2015 6:54:04PM";

The conclusion is that only double digit hours works.  
string strDT = "05/07/2015 06:54:04PM"; doesn't work either because this is a date time object not a string.

I don't know what I can do to work around this.
I wonder if this is a known Hyland bug.


Jed_Kaplowitz
Star Contributor
Star Contributor

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

 

Hey Jed,

Sorry I didn't get back to you yesterday, had some other issues to check into. My next suggestion was API Support (apisupport@onbase.com) based on seeing the same in the TC. Without knowing too much of what's happening behind the scenes it does appear to be a parsing issue between clients, but I don't know for sure.

Luckily, [support] should be able to get you sorted out and send you through the correct channels to get this resolved or find a good way to fix it.

Thanks Patrick...
API certification is a wonderful thing... One day 🙂 Then watch out API Support people!
Once I discovered this is an OnBase Thick Client issue and not a Unity Script issue, I felt that I could call Hyland Standard Support. Hyland Standard support gave me a valid explanation (mentioned above). I would love to dig deeper, but I have to be satisfied with what they gave me. Seems there's an SCR in place for this. Maybe this is not a problem in version 14, or 15. I would think it's not.
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.