cancel
Showing results for 
Search instead for 
Did you mean: 

Get Data type of a filed in a collection

vinodchinthakin
Level 9
Hi All,

I have a scenario where after getting data from Excel/API/DB into BP collection, I need to find the data type of a specific field in a collection.

Do we have any action or code for that?

------------------------------
vinod chinthakindi
------------------------------
5 REPLIES 5

Hi Vinod,

I believe we already have an action under 'Utility - Collection Manipulation' called as 'Get Collection Fields' which will return us an output collection with field name and field type for all the fields present in the input collection that has been passed to it.

14228.png

------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Hi Vinod,

You can use 'Get Collection Fields' action from default Utility - Collection Manipulation VBO. You just have to provide collection name as input and the output will give you a collection with the field names and their data types. You can then find the data type of any field you want.

Input Collection:
14232.png
Action:


14233.png

Output Collection:

14234.png

------------------------------
Vikrant Sharma
Senior Solution Designer
Blue Prism
------------------------------
Vikrant Sharma Senior Solution Designer Blue Prism

Hi @devneetmohanty07. @Vikrant Sharma

I am aware of this action Get collection Fields. 
Get collection Fields  action provides all fields, I can use a loop stage or filter option not a big problem, But looking for a step where it can exact specific field data type

------------------------------
vinod chinthakindi
------------------------------

Hi Vinod,

Whenever you interact with any application using Blue Prism, Blue Prism has its own internal methods/code stages of grabbing that data and converting it to a collection with how the data format seems to be. What you are asking is to decipher the way in how Blue Prism is trying to decode those field types which might not be in scope of ours as we can only determine what is the data type once the data has been grabbed by Blue Prism's code stage or any internal coding framework. This ask has to be either handled at the application end or you need to always forcefully cast it to the specific data format once Blue Prism grabs the data for you.

I will shed some light on both of these approaches:

If you want to allow a specific format to be included changes need to be done at the excel side where you can change the formatting of any column and in case of API you will have to change the back end code of the API to always restrict the data types to be of a common format.

If you are at times getting the data as 'Date/DateTime' type of data my suggestion would be to cast the data into a specific type always no matter what type of data you get. You can have a similar collection with the same column name as a text type and just use a calculation stage to forcefully cast it in that way.

------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Hi Dev,

Thanks for our explanation.
When you say "you need to always forcefully cast it to the specific data format once Blue Prism grabs the data for you." Sometimes it doesn't work, for example casting a Text into number or Text into a Datetime formats.
In case of API, I can check with the respective team to be resolved. But it also happened while reading data from Excel to BP on different machines using similar version of BPV6.9 That's why I want to check data type of a specific field before performing any action (like Filter collection-faced issues while filtering field when it text and date type).

"just use a calculation stage to forcefully cast it in that way." I can do it but once datetime field converted to text to perform some actions, the output needs datetime field where am facing issue while casting text to datetime.




------------------------------
vinod chinthakindi
------------------------------