Browse Source

fix: XOR - formula function

pull/7019/head
Pranav C 1 year ago
parent
commit
86ec3678c7
  1. 8
      packages/nocodb/src/db/functionMappings/pg.ts

8
packages/nocodb/src/db/functionMappings/pg.ts

@ -219,14 +219,10 @@ const pg = {
}, },
XOR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => { XOR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => {
const args = await Promise.all( const args = await Promise.all(
pt.arguments.map(async (arg) => { pt.arguments.map(async (arg) => `${(await fn(arg)).builder}`),
return knex.raw(
`(${(await fn(pt.arguments[0])).builder} IS NOT NULL)::INTEGER`,
);
}),
); );
return { return {
builder: knex.raw(`check (${args.join(' + ')} = 1)`), builder: knex.raw(`${args.join(' # ')} ${colAlias}`),
}; };
}, },
}; };

Loading…
Cancel
Save