I'm using 10.02.00.04 working with enterprise database.
I'm trying to pre-populate a table with data from 2 other tables. modifying gr005 my rule works fine as long as all the fields I'm pulling from have a value. Otherwise I get this:
When I try to edit my sql query to use ISNULL I get
sSql = "Select [LABSAMPLES].GintRecID, [LABSAMPLES].gINTProjectID, [LABSAMPLES].PointID, [LABSAMPLES].Depth, [LABSAMPLES].SampleNO, [LABSAMPLES].SampleDepths, [LABSAMPLES].Visuals, " & _ "[FIELDLITHOLOGY].GintRecID, [FIELDLITHOLOGY].gINTProjectID, [FIELDLITHOLOGY].PointID, [FIELDLITHOLOGY].Depth, " & _ "IsNull([FIELDLITHOLOGY].Color, 'x' )" & _ " From [LABSAMPLES] Left Join [FIELDLITHOLOGY] On [LABSAMPLES].gINTProjectID=[FIELDLITHOLOGY].gINTProjectID And [LABSAMPLES].PointID=[FIELDLITHOLOGY].PointID And [LABSAMPLES].depth=[FIELDLITHOLOGY].depth" & _ " Where [" & s_samp_table & "]." & gs_PointID & " = '" & _ gINTRules.GridData.ForeignKeyValues(gs_PointID) & "'" & _ " and [" & s_samp_table & "].gINTProjectID = " & CStr(gINTRules.EnterpriseCurrPrjID) & _ " Order By [" & s_samp_table & "]." & gs_Depth
the code translates into this which works fine if i run it on the sql server
Select [LABSAMPLES].GintRecID, [LABSAMPLES].gINTProjectID, [LABSAMPLES].PointID, [LABSAMPLES].Depth, [LABSAMPLES].SampleNO, [LABSAMPLES].SampleDepths, [LABSAMPLES].Visuals, [FIELDLITHOLOGY].GintRecID, [FIELDLITHOLOGY].gINTProjectID, [FIELDLITHOLOGY].PointID, [FIELDLITHOLOGY].Depth, IsNull([FIELDLITHOLOGY].Color, 'x' ) From [LABSAMPLES] Left Join [FIELDLITHOLOGY] On [LABSAMPLES].gINTProjectID=[FIELDLITHOLOGY].gINTProjectID And [LABSAMPLES].PointID=[FIELDLITHOLOGY].PointID And [LABSAMPLES].depth=[FIELDLITHOLOGY].depth Where [LABSAMPLES].PointID = '1' and [LABSAMPLES].gINTProjectID = 2 Order By [LABSAMPLES].Depth
any help would be greatly appreciated.
Thank you. with that to work with I got this to work:
iif(IsNull([FIELDLITHOLOGY].Color), 'x', [FIELDLITHOLOGY].Color ) as color
try this...
IsNull([FIELDLITHOLOGY].Color, 'x' )
should be
if(IsNull([FIELDLITHOLOGY].Color),'x','')
Phil WadeDatgelBentley Channel Partner and Developer PartnerE: phil.wade@datgel.com | T: +61 2 8202 8600 & +65 6631 9780
Get the most out of gINT with Datgel Tools.