102
Views
7
Comments
how to get specific attribute values from a list

Dear Team

I have a list loaded with data from excel with multiple attributes, each attributes needs to be validated based on the requirement. one might be numeric other might be string and length also is different. i want to know is there a way i can get all the data of a single attribute from the list so that i can do validation for each attribute one at a time. we can create a local variable and loop the records and put it in the variable but i need to create 31 local variables for 31 attributes so is there any other way. please advise

note: each attribute data has different set of validation

Thanks

Kumar

2024-02-16 07-43-18
Amit Verma

Hi @saravana kumar v ,

can you please share sample OML file and also excel sheet (sample). 

Thanks,

Amit


2020-07-29 19-08-40
Sanjay Kumar Sahu

Hello,

I believe, an attribute(a column in excel) will have only one data type. In that case, you can just create a local variable of type List of a Structure(have same attribute as excel). Now you can validate your excel in the loop and store validated data in that single local var.

UserImage.jpg
saravanakumar v

Hi Sanjay

i have around 31 attributes in the structure. for all 31 attributes i have different set of validation rules i need to verify. so i am trying to group them into a list for example: if the first attribute name is yyy i want a list containing all the yyy data in it so that i can verify the data. could you please suggest me a best solution to group them

Thanks

Saravana Kumar V

2020-07-29 19-08-40
Sanjay Kumar Sahu

Hi Saravana,

I was talking about same scenario, you don't need to create multiple list, instead just create one Structure with all 31 attributes and validate each attribute in loop using switch/If condition. Something like below snap:



Conditions in the Switch will be 1st condition for your attribute for a particular attribute:

Further more you can again validate/verify data using If conditions(if required), ValCondition1(in snap).

And later you can assign or just add validated data into a local variable of type List(Ex. var below), using ListAppend.

Hope it helps!!

UserImage.jpg
saravanakumar v

Hi Sanjay

Sorry i was not clear on the requirement. for each attribute data i have 5 different validations i need to do. These validations change for each attribute.

for example: a particular attribute can have same value for the whole excel

some attributes are required some are not required. each attribute length will be different. we need to validate the length. 

what i am doing right now is that i have a master list with all the attributes as separate list inside that master list. i run a loop to add the data for each attribute and after that i send the whole list of data for a particular attribute to do all the validations. i have stored the validations in a table i retrieve them based on the attribute and do the validation. kindly let me know if this is ok or any other better solution can be done

Thanks

Saravana Kumar V

2020-07-29 19-08-40
Sanjay Kumar Sahu

I did understood the problem Saravana and solution is same. As per my solution you can use 31 conditions(just check attribute name/column name here) in Switch for each attributes then you can again apply number of validations for each attribute you want. Upon data validated, you can add in a Local variable of type List of Structure(like my last snap), you don't need to create separate list for each attribute, you just need to identify correct attribute name from that single list.

Or Post your OML/Excel with snap of your action for more clarity.

UserImage.jpg
Nani

Hi, saravana

I have Understood the problem your Facing i have already worked it but there is no way.

you have to create 31 list variable to validate and running loop on 31 variable list .

You have to run loop 31times but to vaildate u can use Javascript instead of logic.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.