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
mkankatala
(Mahesh Kankatala)
January 8, 2024, 12:50pm
2
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
mkankatala
(Mahesh Kankatala)
January 8, 2024, 12:59pm
4
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
ppr
(Peter Preuss)
January 8, 2024, 1:00pm
6
Sree_Krishnan_vellinezhi:
logF_BusinessProcessName,Mobility,
Process Related,
BotName,MasterBot,
Case_Limit,3000,
Initialization Email List,
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)
mkankatala
(Mahesh Kankatala)
January 8, 2024, 1:01pm
7
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
Even we can use generate datatable using comma seperation and convert it but am trying to convert it without datatable involvement.
mkankatala
(Mahesh Kankatala)
January 8, 2024, 1:05pm
12
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
Can we avoid duplicates in the linq ?
ppr
(Peter Preuss)
January 8, 2024, 1:13pm
17
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 ?
mkankatala
(Mahesh Kankatala)
January 8, 2024, 1:21pm
19
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,
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