<cfquery name="getTable" datasource="#session.sysdb#"> SELECT DictionaryTable.TableKey, DictionaryTable.DisplayOrder, DictionaryTable.ReportKey, DictionaryField.ReportKey, DictionaryField.TableKey, DictionaryField.DisplayOrder, DictionaryField.LookupTable, DictionaryField.LookupType, DictionaryField.IsPickList, DictionaryTable.TableShortName, DictionaryField.FieldName FROM DictionaryTable INNER JOIN DictionaryField ON DictionaryTable.TableKey = DictionaryField.TableKey WHERE DictionaryTable.ReportKey = '#url.reportkey#' AND DictionaryField.ReportKey = '#url.reportkey#' ORDER BY DictionaryTable.DisplayOrder, DictionaryField.DisplayOrder </cfquery>
thats the first query. nothing complicated there. problems arise with my second query. i need to use DictionaryField.LookupTable and DictionaryField.LookupType from the first query in the second.
<cfquery name="Lookup" datasource="#session.sysdb#"> SELECT LookupType, LookupValue, DisplayOrder FROM #DictionaryField.LookupTable# WHERE LookupType = #DictionaryField.LookupType# ORDER BY DisplayOrder, LookupValue </cfquery>
the reason i am using 2 queries is because i have to loop each query separately to get the data i need and to have it displayed properly. any ideas would be greatly appreciated!! i am kinda stumped
thanks!!
i just realized this might help too. here is the section where i loop the queries. i am displaying all of the data in a spreadsheet.
<cfoutput query="getTable"> <ss:Row> <ss:Cell ss:Index="1" ss:StyleID="TopLeft"><ss:Data ss:Type="String">#FieldName#</ss:Data></ss:Cell> <ss:Cell ss:Index="2" ss:StyleID="Top"><ss:Data ss:Type="String">#TableShortName#</ss:Data></ss:Cell> </ss:Row> <ss:Row> <cfif #IsPickList# eq "0"> <ss:Cell ss:Index="1" ss:StyleID="BottomLeft"><ss:Data ss:Type="String">Lookup Values:</ss:Data></ss:Cell> <ss:Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="BottomRight"><ss:Data ss:Type="String">This field is not a picklist</ss:Data></ss:Cell> </ss:Row> <ss:Row></ss:Row> <cfelse> <ss:Cell ss:Index="1" ss:StyleID="BottomLeft"><ss:Data ss:Type="String">Lookup Values:</ss:Data></ss:Cell> <cfloop query="Lookup"> <ss:Cell ss:Index="2" ss:MergeAcross="3" ss:StyleID="BottomRight"><ss:Data ss:Type="String">#LookupValue#, </ss:Data></ss:Cell> </cfloop> </ss:Row> <ss:Row></ss:Row> </cfif> </cfoutput>

New Topic/Question
Reply




MultiQuote




|