Entering data in UDFs
Entering data into the fields that you created is done by going to the ‘User Defined’ tab of the module.
All the formatting you applied when setting up the fields, are respected.
Creating Reports on UDF data
Open Crystal Reports and edit the report that needs UDF data added to it. In this example we will edit the ‘Inventory Stock Status’ report.
Go to ‘Database Expert’ and add the tables that are required for the report.
Set the join type to ‘Left OuterJoin’
Click OK
Add a SQL Expression Field by right clicking and selecting ‘New’
Give the SQL Expression a name. This example is ‘StoreTemp’
The SQL expression looks like this – ((inventory.udf_data)->‘StoreTemp’)::numeric
Other examples”
- ((inventory.udf_data)->‘GlutenFree’)::boolean
- ((inventory.udf_data)->‘Kosher’)
- ((inventory.udf_data)->‘NutFree’)
NOTE
- the Field Name is case sensitive
- ::numeric denotes a number field in Crystal Reports Designer
- ::date denotes a date field
- ::boolean denotes True/False
- if ::type is left off then it will be a text field
Once data is saved here is what it looks like stored in a field called udf_data
The expression can now be added to the report.In this example we added 4 UDF fields along with a label.
The printed report