Hi,
I am struggling with the correct syntax to check if a field exists in an entry for index binding.
My try:
CreateIndex({
name: "test",
source: [
{
collection: Collection("entries"),
fields: {
name: Query(
Lambda('entry',
Concat(
[
Select(['data',field_1'],Var('entry')),
If(
ContainsField("field_3",Var('entry')),
Select(['data','field_3'],Var('entry')),
Select(['data','field_2'],Var('entry'))
)
],
" ")
),
)
}
}
],
terms: [],
values: [
{ binding: "name" },
]
})
The problem seems Var(‘entry’) is not an “object” I can use with ContainsField.