开发者

ColdFusion 9 ORM CFGird connecting several tables

开发者 https://www.devze.com 2023-03-04 17:38 出处:网络
When using ColdFusion ORM where you have several tables with relationships can I bind a CFC to a CFGrid to get all of the columns I would like to have displayed?

When using ColdFusion ORM where you have several tables with relationships can I bind a CFC to a CFGrid to get all of the columns I would like to have displayed?

Example if I have a query with 7 joins on the current application I am working on to get all of the fields I want displayed. How can I display all of the fields in CFGrid can I use bind to connect the ORM CFC to the Grid? or Do I need to do something else?

SELECT 'PRIMARY' AS TMSType,
  'Request'      AS shopTypeTitle,
  rfc_shopsheet.shopsheetid,
  locked,
  isDraft,
  shoptype,
  rfc_shopsheet.createdon,
  FacilitatorCompleted,
  Details.myshopfolderid   AS RecordId,
  Details.subject          AS ShopSubject,
  Details.solostandmodelid AS DisplayModelid,
  ShopVACM.solostandmodel  AS DisplayModel,
  Details.myshoplevelid,
  Details.divisionid,
  val_myshoplevel.name,
  divisionname,
  GROUP_CONCAT_solostandSERIES(rfc_shopsheet.shopsheetid) AS Series,
  MAX(RequestDTGs.sortdate)                               AS RSortDate,
  MAX(RequestDTGs.sortsequence)                           AS RSeq,
  rfc_shopsheet.CreatedOn                                 AS holdshopCreateDate,
  Details.AIRSNbr
FROM rfc_shopsheet
JOIN rfc_myshopfolder Details
ON rfc_shopsheet.myshopFolderId = Details.myshopFolderId
LEFT OUTER JOIN rfc_shopsigner
ON rfc_shopsheet.shopsheetid = rfc_shopsigner.shopsheetid
LEFT OUTER JOIN rfc_requestdtg RequestDTGs
ON RequestDTGs.myshopfolderid = Details.myshopfolderid
LEFT OUTER JOIN rfc_engshop
ON rfc_shopsheet.shopsheetid = rfc_engshop.shopsheetid
LEFT OUTER JOIN rfc_requestaircraft RequestAC
ON Details.myshopfolderid = RequestAC.myshopfolderid
LEFT OUTER JOIN rfc_requestfacilitator RequestFac
ON Details.mysh开发者_运维知识库opfolderid = RequestFac.myshopfolderid
LEFT OUTER JOIN val_solostandseries shopVAC
ON RequestAC.solostandseriesid = shopVAC.solostandseriesid
LEFT OUTER JOIN val_solostandmodel shopVACM
ON Details.solostandmodelid = shopVACM.solostandmodelid
LEFT OUTER JOIN val_myshoplevel
ON Details.myshoplevelid = val_myshoplevel.myshoplevelid
LEFT OUTER JOIN val_division
ON Details.divisionid = val_division.divisionid
WHERE shopType        = 'F'

I would like to find a way to get ORM to join all of these columns so I can put them in ORM.


So that I understand, you have not yet built any ORM Entities? (CFC for each table)

If you have not, all you have to do is setup all your tables (use cfbuilder with a RDS connection to build your ORM CFC files)

Once you have all your tables referenced in ORM Persisted CFC files, you can do this with a cfquery tag and dbtype = "HQL" and return the data with QueryConvertForGrid()

Then just return the data you want to your cfgrid via json or directly on the page into the cfgrid tag.


<cfgrid> doesn't freaking care whether you're using ORM or not.

So just do your joins using <cfquery>, and return the result using QueryConvertForGrid() in your remote function. If you're not using bind, then just feed <cfgrid> with the actual query.

0

精彩评论

暂无评论...
验证码 换一张
取 消