Convert comma seperated text to a dictionary

i am having a textfile which contains key values with comma seperated. how can i convert it into dictionary without using generate datatable activity.

example data in text file –

Name,Value,Description
logF_BusinessProcessName,Mobility,
Process Related,
BotName,MasterBot,
Case_Limit,3000,
Initialization Email List,

I need to read this text file and convert it into dictionary

Hi @Sree_Krishnan_vellinezhi

May I know the expected output.

DIctionary need to assign as key value pair

for example

keys-- logF_BusinessProcessName,Processrelated,Botname,CaseLimit,Initializationmaillist
values-Mobility,Masterbot,3000

In your example text there is no equal pairs of key and value. Check once @Sree_Krishnan_vellinezhi

yeah some keys are having blank values , that we have to ignore

looks like CSV data

so we can do:

  • Read CSV Activity - out: dtData

Assign Activity:
dictData | Dictionary(OF String, String) =
dtData.AsEnumerable.ToDictionary(Function (x) x(0).toString, Function (x) x(1).toString)

grafik

Give me the pairs properly @Sree_Krishnan_vellinezhi

@ppr any way to avoid Datatable ?
this one i have already done

leave it bro u cant … thanks for your response

grafik

Even we can use generate datatable using comma seperation and convert it but am trying to convert it without datatable involvement.

You said it is text and you provided input is wrong. There is no spaces between some of the commas. How can I validate in which place there is spaces. @Sree_Krishnan_vellinezhi

how u r reading a text file using read csv activity ??? this comes in a text file

grafik

Can we avoid duplicates in the linq ?

Yes

Just redefine in detail and at complete base the use case along with representative sample data.
We will have a look at the revised description

You mean i need to try the latest query ?

See here @Sree_Krishnan_vellinezhi

If your input as below

logF_BusinessProcessName,Mobility,
Process Related,,
BotName,MasterBot,
Case_Limit,3000,
Initialization Email List,,

Then here is the output,
image

If you don’t know how to do it check the below workflow,

2024.xaml (19.3 KB)

Hope you understand!!

how this will work for dictionary of string,object