Help

Re: Error ''No overload matches this call ...'' when creating new records

1427 0
cancel
Showing results for 
Search instead for 
Did you mean: 
hnikolic
4 - Data Explorer
4 - Data Explorer

Hi! I have 2 tables from which I am making some matches with scores. There results need to be put in the third table. I am trying to create new records like this:

for (let i = 0; i < 5; i++) {
let mentor_index = ranked_mentors_indexes[i];
let new_matching = {
"Unique IO Mentee": mentees.records[mentee_index].getCellValue(field_mentee_index),
"Unique ID Mentor": mentors.records[mentor_index].getCellValue(field_mentor_index),
"procentage": similarity_matrix[mentee_index][mentor_index],};
await table_matchings.createRecordAsync(new_matching);
}
 
I am getting this error that I do not know how to resolve:
No overload matches this call.
Overload 1 of 2, '(fields: { "Unique ID Mentee"?: readonly { id: string; }[] | undefined; fldBBVDi3w6mPEQHI?: readonly { id: string; }[] | undefined; "Unique ID Mentor"?: readonly { id: string; }[] | undefined; fldb2AlrU2AJShSc3?: readonly { id: string; }[] | undefined; procentage?: number | undefined; fldgTMwV2nFs4Uv26?: number | undefined; }): Promise<...>', gave the following error.
Argument of type '{ "Unique IO Mentee": string; "Unique ID Mentor": string; procentage: any; }' is not assignable to parameter of type '{ "Unique ID Mentee"?: readonly { id: string; }[] | undefined; fldBBVDi3w6mPEQHI?: readonly { id: string; }[] | undefined; "Unique ID Mentor"?: readonly { id: string; }[] | undefined; fldb2AlrU2AJShSc3?: readonly { id: string; }[] | undefined; procentage?: number | undefined; fldgTMwV2nFs4Uv26?: number | undefined; }'.
Types of property '"Unique ID Mentor"' are incompatible.
Type 'string' is not assignable to type 'readonly { id: string; }[] | undefined'.
Overload 2 of 2, '(fields: { "Unique ID Mentee"?: readonly { id: string; }[] | undefined; fldBBVDi3w6mPEQHI?: readonly { id: string; }[] | undefined; "Unique ID Mentor"?: readonly { id: string; }[] | undefined; fldb2AlrU2AJShSc3?: readonly { id: string; }[] | undefined; procentage?: number | undefined; fldgTMwV2nFs4Uv26?: number | undefined; }): Promise<...>', gave the following error.
Argument of type '{ "Unique IO Mentee": string; "Unique ID Mentor": string; procentage: any; }' is not assignable to parameter of type '{ "Unique ID Mentee"?: readonly { id: string; }[] | undefined; fldBBVDi3w6mPEQHI?: readonly { id: string; }[] | undefined; "Unique ID Mentor"?: readonly { id: string; }[] | undefined; fldb2AlrU2AJShSc3?: readonly { id: string; }[] | undefined; procentage?: number | undefined; fldgTMwV2nFs4Uv26?: number | undefined; }'.
Types of property '"Unique ID Mentor"' are incompatible.
Type 'string' is not assignable to type 'readonly { id: string; }[] | undefined'.
1 Reply 1

Hi,
'fieldname' : value is a format to write in text field
it seems like your Unique.. fields are linked fields. You should write array of {id:recXXXYYYZZZ} objects in it
Also, procentage is a number field, so you can't write text in it.
If your similarity_matrix is 2d array of numbers stored as text, you should do smth like
"procentage": Number(similarity_matrix[mentee_index][mentor_index])