CAST In BAQ JOIN clause

,

Hi,

I’m trying to join the Part table with the Country table in a BAQ.

I know I need to join the Part.ISOrigCountry field with the Country.CountryNum field.

The problem is that:

  • Part.ISOrigCountry field is an nvarchar column.
  • Country.CountryNum is an int column.

In SQL I can CAST/CONVERT the value to an int but how can I do this through a BAQ JOIN?

Thanks.

I’m an idiot!

I didn’t even try testing this.

Epicor knew what to do in the background so it must have automatically casted/converted the value for me.

One thing to be careful of is to make sure the nvarchar column will always contain a value that can be casted to an int. You can also specify the casts in the join conditions, so if the nvarchar column may contain a non-int, you can cast the int value to an nvarchar (the example below doesn’t really make sense, but it shows how to specify your own casts):

2 Likes