INTERACT FORUM

More => Old Versions => JRiver Media Center 25 for Windows => Topic started by: DrKNo on April 07, 2019, 10:09:32 am

Title: Query field type via mcws
Post by: DrKNo on April 07, 2019, 10:09:32 am
Is it possible to query the field type via mcws? The documentation doesn't mention anything. Apparently it is possible to create fields along with a type, but not possible to query the type. This would be really useful for automatic type conversion in scripts. Soooo.... pretty please? =)
Title: Re: Query field type via mcws
Post by: Matt on April 08, 2019, 01:42:45 pm
Could you expand a little on what you're thinking?  A way to specify a type like "String" and get a list of all the matching fields?

It's a little tricky because fields have a data type and an edit type and I'm not sure which we would search.

Thanks for any clarification.
Title: Re: Query field type via mcws
Post by: Hendrik on April 08, 2019, 02:18:40 pm
I figure he wants to determine the type of existing fields, not search by type, so if you get a list of values you know eg. which is a Date field, and which is a plain number field. I've had this thought before when w orking on JRemote, since it just wouldn't know which kind of field is a Date.
Title: Re: Query field type via mcws
Post by: Matt on April 08, 2019, 02:26:00 pm
So would it be adding the data type and/or edit type to the Library/Fields function?
Title: Re: Query field type via mcws
Post by: DrKNo on April 08, 2019, 04:22:58 pm
Thank you for your consideration!
When creating a field, you have to specifiy a data type (e.g. Date, String, Integer...). When querying fields from mcws, knowing these field types would allow proper casting. I didn't even consider the edit type, but this would actually be useful as well in order to provide the best input field for users.

Hendrick got what I meant: Ideally I'd need an endpoint that returns the field names along with the data and edit types, or, optionally, an endpoint that I give a field name as parameter, and input and edit type are returned. Adding this data to the Library/Fields function would be ideal from my point of view, I don't know if that would break backwards compatibility though.

Edit: On the risk of sounding ungrateful, but could we maybe get relational type and allowed values as well?  :)
Title: Re: Query field type via mcws
Post by: Matt on April 08, 2019, 04:38:36 pm
I can add that tomorrow.  Thanks for the idea  ;)
Title: Re: Query field type via mcws
Post by: MrBiff on April 08, 2019, 04:45:29 pm
It would be nice to expand:

http://localhost:52199/MCWS/v1/Library/Fields

to return some XML which indicated the field's edit and data types, acceptable values, etc.  Currently it returns only the field name for non-calculated fields, and the field name + expression for calculated fields.

Likewise, the CreateFields input should take the same XML structure to be able to fully specify the created fields.

I use these new features frequently, so thanks for adding them.
Title: Re: Query field type via mcws
Post by: DrKNo on April 09, 2019, 01:35:27 am
I can add that tomorrow.  Thanks for the idea  ;)

Thank you so much, Matt <3
Title: Re: Query field type via mcws
Post by: Matt on April 09, 2019, 08:15:29 am
Coming next build:
NEW: Added the edit type and data type to the MCWS Library/Fields function.

Thanks again for the suggestion.