Wondering if the community can help me with this. I need to search the Forms database for instances where a specific field equals a value. I am able to find the value I'm looking for in the cf_bp_data table, but how do you tie that back to the instance id and instance name?
Question
Question
Answer
Thank you all for your help. Here is what we came up with for our scenario:
The value that we are looking for is in attribute_id 100 and the status =1 gives us active instances.
SELECT cbd.attribute_id ,cbmi.STATUS ,cbmi.title ,cbd.value FROM LF_Forms.dbo.cf_submissions AS cfs INNER JOIN LF_Forms.dbo.cf_bp_data AS cbd ON cfs.submission_id = cbd.submission_id INNER JOIN LF_Forms.dbo.cf_bp_main_instances AS cbmi ON cfs.bp_instance_id = cbmi.bp_instance_id WHERE (cbd.attribute_id = 100) AND (cbmi.STATUS = 1)
Replies
Hi Blake,
Hopefully this is correct...
cf_bp_data - gets you the submission_id
then in
cf_form_submissions - use the submission_id to get the process_id
finally
cf_business_process - use the process_id to get the name of the form etc.
Thank you for the reply Jonathan. Do you know how to tie it into the cf_bp_worker_instnc_to_resume table? I only want to retrieve active instances.
The [dbo].[cf_business_processes] has column [is_activated] that should be able to filter only active processes.
Ah, I missed that when I was looking through the tables. Thank you Bert!
The cf_business_process table is for the processes, I am needing the instance name.
looks like you want to include the [dbo].[cf_bp_main_instances] in your query
I think this will get you what you need and more
SELECT [cbd].[bp_data_id] ,[cbd].[submission_id] ,[cbd].[attribute_id] ,[cbd].[repeat_id] ,[cbd].[value] ,[cbd].[member_path] ,[cfs].[process_id] ,[cfs].[step_id] ,[cfs].[draft_email] ,[cfs].[draft_pwd] ,[cfs].[draft_contains] ,[cfs].[draft_name] ,[cfs].[form_id] ,[cbp].[bp_id] ,[cbp].[date_created] ,[cbp].[name] ,[cbp].[description] ,[cbp].[date_updated] ,[cbp].[is_activated] ,[cbp].[is_deleted] ,[cbp].[is_archived] ,[cbp].[status_date_updated] ,[cbp].[is_triggerpublic] ,[cbp].[update_option] ,[cbp].[is_savetolf] ,[cbp].[friendly_bp_id_col] ,[cbp].[friendly_name] ,[cbp].[savetolf_format] ,[cbp].[style_json] ,[cbp].[is_savetolf_xml_included] ,[cbp].[tenant_id] ,[cbp].[created_by_snapshot_id] ,[cbp].[updated_by_snapshot_id] ,[cbp].[status_updated_by_snapshot_id] ,[cbp].[pm_updated_by_snapshot_id] ,[cbp].[faq_options] ,[cbp].[faq_group_id] ,[cbp].[faq_group_name] ,[cbp].[custom_error_msg] ,[cbp].[is_terminal_notification_enabled] ,[cbp].[terminal_email_template] ,[cbp].[is_suspend_notification_enabled] ,[cbp].[suspend_email_template] ,[cbp].[instance_data_retention_enabled] ,[cbp].[instance_data_retention_days] ,[cbp].[instance_stats_retention_enabled] ,[cbp].[instance_stats_retention_days] ,[cbp].[keep_analytics_data] ,[cbp].[unique_id] ,[cbp].[pm_date_updated] ,[cbp].[hide_history_from_initiator] ,[cbp].[hide_history_from_participant] ,[cbp].[storage_type] ,[cbp].[volume_id] ,[cbp].[attachment_migration_status] ,[cbsfm].[process_id] ,[cbsfm].[step_id] ,[cbsfm].[form_id] ,[cbmi].[bp_instance_id] ,[cbmi].[ref_bp_instance_id] ,[cbmi].[process_id] ,[cbmi].[start_date] ,[cbmi].[end_date] ,[cbmi].[status] ,[cbmi].[title] ,[cbmi].[user_snapshot_id] ,[cbmi].[lastacted_snapshot_id] ,[cbmi].[lastacted_date] ,[cbmi].[lastacted_comment] ,[cbmi].[bp_name] ,[cbmi].[submission_data_removed] ,[cbmi].[stats_removed] FROM [dbo].[cf_bp_data] AS [cbd] JOIN [dbo].[cf_form_submissions] AS [cfs] ON [cbd].[submission_id] = [cfs].[submission_id] JOIN [dbo].[cf_business_processes] AS [cbp] ON [cfs].[process_id] = [cbp].[bp_id] JOIN [dbo].[cf_bp_step_form_mapping] AS [cbsfm] ON [cfs].[process_id] = [cbsfm].[process_id] JOIN [dbo].[cf_bp_main_instances] AS [cbmi] ON [cfs].[process_id] = [cbmi].[process_id] WHERE [cfs].[step_id] = [cbsfm].[step_id] AND [cbp].[is_activated] = 1
Thank you all for your help. Here is what we came up with for our scenario:
The value that we are looking for is in attribute_id 100 and the status =1 gives us active instances.
SELECT cbd.attribute_id ,cbmi.STATUS ,cbmi.title ,cbd.value FROM LF_Forms.dbo.cf_submissions AS cfs INNER JOIN LF_Forms.dbo.cf_bp_data AS cbd ON cfs.submission_id = cbd.submission_id INNER JOIN LF_Forms.dbo.cf_bp_main_instances AS cbmi ON cfs.bp_instance_id = cbmi.bp_instance_id WHERE (cbd.attribute_id = 100) AND (cbmi.STATUS = 1)
Blake,
Which table contains the attribute_id please?
dbo.cf_bp_data
Thank you