Use a custom field code in my report

Discussions related to Crystal Reports development.

Moderator: Lisa Ennis

Post Reply
czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Use a custom field code in my report

Post by czentman »

How get I access a custom field code from my crytal report. It's not a document so I don't think I should be using that context ID, it's a regular report. I just want to also access this custom field via the field code. What's the easiest way to do this?
Mark McKenna

Re: Use a custom field code in my report

Post by Mark McKenna »

The custom field data is stored in the same table as the "normal" data belonging to the business object type to which the custom field was associated when created. For example, the custom field data related to a Loan is stored in the Loan table. The data itself is stored in the CustomFields column that is of SQL Server datatype 'XML'.

Numerous views have been created to take away the pain of XQuery, which is what you would otherwise need to use in order to access individual data points out of the XML chunk. These views are named in a recognizable and consistent fashion, such as "CustomLoan", "CustomProperty", and "CustomOrder". These views "flatten" the XML into normal typed columns that you can access like any other field.

Code: Select all

SELECT MyCustomField# FROM [CustomLoan] WHERE ID='E2BAD1DA-27C2-DD11-BD62-001EC967B471'
As for accessing the custom field by its field code from within a document or in ProForm, if I understand your question correctly, you simply use curly braces around the data item name like any other field... like {{.MyCustomField#}}.
Post Reply