Entering data in UDFs

Entering data into the UDF fields that you create is done from the User Defined tab of the module.

Text formatting in UDF setup is respected and will prevent you from typing too many or the wrong type of characters. Any validation errors will appear immediately after exiting a field with an incorrect value.

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’ and save this setting.

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 of UDF fields that could be included:

  • ((“inventory”.“udf_data”)->>‘GlutenFree’)::boolean
  • ((“inventory”.“udf_data”)->>‘Kosher’)
  • ((“inventory”.“udf_data”)->>‘NutFree’)

NOTE

  • the Field Name is case sensitive
  • Table and field names should be surrounded in double quotes
  • ::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.

Below is an image of the report with the UDF formula fields included.

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.