Error in add items to dictionary

Hi all ,

I want to add all items to dictionary , If I add more than 15 items in dictionary it throws error. can anyone let me know how to add all items to dictionary?

BC32042: Too few type arguments to ‘Script.Func232(Of In T0, In T1, In T2, In T3, In T4, In T5, In T6, In T7, In T8, In T9, In T10, In T11, In T12, In T13, In T14, In T15, Out TResult)’. Argument ‘Value’: BC36625: Lambda expression cannot be converted to ‘Expression(Of Func232)’ because ‘Expression(Of Func232)’ is not a delegate type.


1 Like

maybe you split it into two sets

1 Like

DELETED, due fallback on Split Approach

1 Like

Hi @ppr , thanks for replying . I’m using below line looks like there is an issue

empDict = New Dictionary(Of String, Object) From
({
({“EmployeeID”,in_EmployeeID}),
({“EmployeeName”,in_EmployeeName}),
({“Email”,in_Email}),
({“PhoneNumber”,in_PhoneNumber}),
({“Address”,in_Address}),
({“Gender”,in_Gender}),
({“BloodGroup”,in_BloodGroup}),
({“DateOfBirth”,in_DateOfBirth}),
({“DateOfJoining”,in_DateOfJoining}),
({“MaritalStatus”,in_MaritalStatus}),
({“Citizenship”,in_Citizenship}),
({“TotalYearsOfExperience”,in_TotalYearsOfExperience}),
({“Project”,in_Project}),
({“Description”,in_Description}),
({“AadharCardNumber”,in_AadharCardNumber}),
({“PanCardNumber”,in_PanCardNumber}),
({“PassportNumber”,in_PassportNumber}),
({“SkillsList”,in_Skills}),
({“DocumentType1”,in_DocumentType1}),
({“DocumentType2”,in_DocumentType2})
}).ToDictionary(Function (x) x(0) , Function(x1) x1 )

1 Like

DELETED, due fallback on Split Approach

1 Like

DELETED, due fallback on Split Approach

1 Like

Please check

1 Like

Lets fall back to the Split / Concat Approach

New Dictionary(Of String, Object) From
{
{"EmployeeID",in_EmployeeID},
{"EmployeeName",in_EmployeeName},
{"Email",in_Email},
{"PhoneNumber",in_PhoneNumber},
{"Address",in_Address},
{"Gender",in_Gender},
{"BloodGroup",in_BloodGroup},
{"DateOfBirth",in_DateOfBirth},
{"DateOfJoining",in_DateOfJoining}
}.Concat(
New Dictionary(Of String, Object) From {
{"MaritalStatus",in_MaritalStatus},
{"Citizenship",in_Citizenship},
{"TotalYearsOfExperience",in_TotalYearsOfExperience},
{"Project",in_Project},
{"Description",in_Description},
{"AadharCardNumber",in_AadharCardNumber},
{"PanCardNumber",in_PanCardNumber},
{"PassportNumber",in_PassportNumber},
{"SkillsList",in_Skills},
{"DocumentType1",in_DocumentType1},
{"DocumentType2",in_DocumentType2}
}
).ToDictionary(Function (x) x.Key , Function(x) x.Value )

We just split and concat inorder not to exceed the max of Items usable within the initialization

1 Like

Just use a Multiple Assign to populate the dictionary.

ie Assign yourDict(“EmployeeID”) = in_EmployeeID

1 Like

Looks like same delegation error in here too. is it working for you?


1 Like

Yes it is working
grafik

But still you have the option to create 2 or more Dicitionary Variables and got it split. Afterwards we could concat as done as above

But when not explicitly looking at a core coding approach we agree with Pauls’s point and it can be done through assignments

1 Like

you can first declare the dictionary then add one by one .

dictionary(“key”) = value

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.