QB missing addPk() with other columns

Hi All

Concerning a Query Builder statement, mixing addPk() in addition to other columns (even from joined tables) should work ok, is it?

			var query = datasources.db.hades.profile_definitions.createSelect();
			var pd = query.columns;
			query.result
				.addPk()
				.add(pd.assessment_code_exam_mark)
				.add(a.discriminator);
			/** @type {QBJoin<db:/hades/assessments>} */
			var join = query.joins.add('db:/hades/assessments', JSRelation.LEFT_OUTER_JOIN);
			var a = join.columns;
			join.on
				.add(pd.assessment_code_exam_mark.eq(a.code));
			query.where
				.add(pd.level_number.eq(datasetExamSubjects.getValue(j, 4)))

Regards,

Yes.

I think your code should throw an error though. You declare “a” after you use it in the result. In general I think it is always easiest to simply test stuff :o . When it comes to queries, I always find it very easy to verify what goes by putting a breakpoint before the query is actually fired, then go to servoy-admin/database-performance, clear that, step over the breakpoint and then simply look at the query that is printed in database-performance.

I agree testing is necessary, but I also like to know how something is intended by Servoy. Thanks for the tip.

Regards,