Autolookup to SQL Database - need syntax for referenced fields in subform
Hi, i have a manual sql query used in an autolookup. I've done this multiple times, but have never had to reference a field in a subform. I can't get the syntax correct. Normally a field is referenced as '${Segment}' but what if "Segment" is in a subform (and the autolook is outside the subform)?
Here's the full name of the field:
${/pd:AP/pd:formFields/pd:CustSalesRel_SubForm/pd:CustSalesRel/pd:Segment}
I've tried the whole thing and just pieces of it, as well as other things.
Thanks for any guidance!
-
Hi Gwen,
In certain scenarios for autolookup field to successfully parse the request, the reference field has to be present either in the root level of the form or in the same level where autolookup is present.
Child field reference path should look like below :
${SubFormFieldInternalName_SubForm/SubFormFieldInternalName/ChildFieldInternalName}
This path will be autoformed if you drag and drop the child field from "Data Model" into the manual query text area.
-
ok, yes, I'm thinking i need to get rid of the subform (move the fields onto the form directly). I tried dragging the field from the subform to the sql, and it validates, but no records are returned when the form is run.
i made a test field directly on the form (not in the subform) and this worked fine:
where (Segment2 = '${TestSegment}' or '${TestSegment}' = '-1')
but when I reference the one in the subform, it won't return records
where (Segment2 = '${CustSalesRel_SubForm/CustSalesRel/Segment}' or '${CustSalesRel_SubForm/CustSalesRel/Segment}' = '-1')
Thanks!
-
Hi Gwen,
Assuming that your AutoLookup control is at root level, there are two solutions
- Move the "Segment" field to the root level
- Move AutoLookup inside subform
Making any of the above change will result in AutoLookup and Segment field to be in same level. Hence the AutoLookup will parse the request and bind the data.
請登入寫評論。
評論
3 條評論