Skip to main content

I got an incompatible error in my method

error COBCH0968 : Collection element has incompatible type

In that  peace of  code "perform varying val through _where_", the compiler say the type Dictionary[type String type String] is incompatible with KeyValuePair[type String type String] to make the perform ( basicly the is the foreach command )....

method-id Update final public.
working-storage section.
01 vals string.
01 val type KeyValuePair[type String type String].
procedure division using by value tableName as string _data_ as type Dictionary[type String type String] _where_ as string returning rtCode as type Boolean.
declare strB = new StringBuilder("").
move true to rtCode.

if(_data_::Count > 1)
perform varying val through _where_
invoke strB::Append(string::Format(" {0} = '{1}',", val::Key::ToString(), val::Value::ToString()))
end-perform
end-if.
end method.

I got an incompatible error in my method

error COBCH0968 : Collection element has incompatible type

In that  peace of  code "perform varying val through _where_", the compiler say the type Dictionary[type String type String] is incompatible with KeyValuePair[type String type String] to make the perform ( basicly the is the foreach command )....

method-id Update final public.
working-storage section.
01 vals string.
01 val type KeyValuePair[type String type String].
procedure division using by value tableName as string _data_ as type Dictionary[type String type String] _where_ as string returning rtCode as type Boolean.
declare strB = new StringBuilder("").
move true to rtCode.

if(_data_::Count > 1)
perform varying val through _where_
invoke strB::Append(string::Format(" {0} = '{1}',", val::Key::ToString(), val::Value::ToString()))
end-perform
end-if.
end method.

Hello Bencz, in the code sample, it looks as though the variable _where_ is of type string.  Did you mean to use the variable _data_?


I got an incompatible error in my method

error COBCH0968 : Collection element has incompatible type

In that  peace of  code "perform varying val through _where_", the compiler say the type Dictionary[type String type String] is incompatible with KeyValuePair[type String type String] to make the perform ( basicly the is the foreach command )....

method-id Update final public.
working-storage section.
01 vals string.
01 val type KeyValuePair[type String type String].
procedure division using by value tableName as string _data_ as type Dictionary[type String type String] _where_ as string returning rtCode as type Boolean.
declare strB = new StringBuilder("").
move true to rtCode.

if(_data_::Count > 1)
perform varying val through _where_
invoke strB::Append(string::Format(" {0} = '{1}',", val::Key::ToString(), val::Value::ToString()))
end-perform
end-if.
end method.

Ohhhhh, s*** :(

haha, I had not noticed :(

Hha, thanks :)