Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Guidance needed creating multi-criteria search form with subform

Questions related to using nuBuilder Forte.
kev1n
nuBuilder Team
Posts: 4296
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Guidance needed creating multi-criteria search form with subform

Unread post by kev1n »

Correct:

Code: Select all

$("[search-field]").each(function() {

    $(this).enterKey(function (e) {
        applySearch();
    });


});
Also make sure that the Primary Key (tblproperties_id) is in the SELECT statement.
Keith-i
Posts: 88
Joined: Wed Jan 18, 2023 3:03 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Guidance needed creating multi-criteria search form with subform

Unread post by Keith-i »

Morning kev1n, I am still not having any joy with this. I've checked through everything and can also confirm that the primary key idProperties is in the select statement. The only debug message I get now is the BB for the iframe. Any thoughts on what I can try next?

Code: Select all

[0] : 

SELECT 

    idProperties,
    BuildingName,
    UnitNo,
    UnitName,
    HouseNo,
    RoadName,
    Parish,
    Postcode

FROM tblProperties LEFT JOIN tblRoads ON tblRoads.idRoads = tblProperties.id_Roads

WHERE (1 = 1)

 AND (1 = 1) 
kev1n
nuBuilder Team
Posts: 4296
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Guidance needed creating multi-criteria search form with subform

Unread post by kev1n »

Could you post another dump of your forms? Without that it's next to impossible to tell what's going wrong.
Keith-i
Posts: 88
Joined: Wed Jan 18, 2023 3:03 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Guidance needed creating multi-criteria search form with subform

Unread post by Keith-i »

Sure, here's the launch form (frm_propsearch)

Code: Select all

-- nuBuilder cloner SQL Dump
-- Version 1.21
-- Generation Time: February 14, 2023 07:57:34 AM

-- Form Description: Property Search
-- Form Code: frm_propsearch
-- Form Table:
-- Form Type: launch


--
-- zzzzsys_form: frm_propsearch_clone_1
--

INSERT INTO zzzzsys_form (zzzzsys_form_id, sfo_type, sfo_code, sfo_description, sfo_breadcrumb_title, sfo_table, sfo_primary_key, sfo_browse_redirect_form_id, sfo_browse_row_height, sfo_browse_rows_per_page, sfo_browse_title_multiline, sfo_browse_autoresize_columns, sfo_browse_sql, sfo_javascript, sfo_browse_javascript, sfo_edit_javascript, sfo_style, sfo_mobile_view, sfo_json) 

VALUES ( '63eb4cfe65a927d', 'launch', 'frm_propsearch_clone_1', 'Property Search', NULL, '', '', '', '0', '0', '0', NULL, '', '// Add an event listener for all filter fields and if the user pressed the \"Search\" key, apply the search\n$(\"[search-field]\").each(function() {\n\n    $(this).enterKey(function(e) {\n        applySearch();\n    });\n\n});\n\nfunction applySearch() {\n\n    var frame = $(\"#iframe_proplist\")[0].contentWindow; // <--- Replace your_iframe_object_id with your iframe object id\n\n    // Set Hash Cookies (HK) for all filter fields:\n\n    // Example: Set HKs for Text fields\n    frame.nuSetProperty(\'prop_name_fltr\', prop_name_srch.value);\n    frame.nuSetProperty(\'unit_no_fltr\', unit_no_srch.value);\n    frame.nuSetProperty(\'unit_name_fltr\', unit_name_srch.value);\n    frame.nuSetProperty(\'house_no_fltr\', house_no_srch.value);\n    frame.nuSetProperty(\'road_name_fltr\', road_name-srch.value);\n    frame.nuSetProperty(\'postcode_fltr\', postcode_srch.value);\n\n    // Set HKs for Boolean fields\n    //frame.nuSetProperty(\'filter_adr_active\', nuGetValue(\'adr_active\') ? \'1\' : \'\');\n\n    frame.nuGetBreadcrumb();\n\n}', NULL, NULL, NULL, NULL, NULL ); 


--
-- zzzzsys_tab
--

INSERT INTO zzzzsys_tab (zzzzsys_tab_id, syt_zzzzsys_form_id, syt_title, syt_order, syt_help, syt_access, syt_json) 

VALUES ( '63eb4cfe6600290', '63eb4cfe65a927d', 'Main', '10', NULL, NULL, NULL ); 


--
-- zzzzsys_object
--

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66a6afd', '63eb4cfe65a927d', 'Launch Form 1', 'input', 'prop_name_srch', 'Property Name', '63eb4cfe6600290', '40', '12', '127', '200', '22', '1', 'left', '0', '0', '0', NULL, NULL, '', '', '', '', '', NULL, NULL, '', '', '', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '', 'text', NULL, '', NULL, 'search-field', '0', '', '', '', '', '', '', '', NULL, NULL ); 

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66ab411', '63eb4cfe65a927d', 'Launch Form 1', 'input', 'unit_no_srch', 'Unit No', '63eb4cfe6600290', '50', '44', '127', '200', '22', '1', 'left', '0', '0', '0', NULL, NULL, '', '', '', '', '', NULL, NULL, '', '', '', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '', 'text', NULL, '', NULL, 'search-field', '0', '', '', '', '', '', '', '', NULL, NULL ); 

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66af43b', '63eb4cfe65a927d', 'Launch Form 1', 'input', 'unit_name_srch', 'Unit Name', '63eb4cfe6600290', '60', '76', '127', '200', '22', '1', 'left', '0', '0', '0', NULL, NULL, '', '', '', '', '', NULL, NULL, '', '', '', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '', 'text', NULL, '', NULL, 'search-field', '0', '', '', '', '', '', '', '', NULL, NULL ); 

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66b2320', '63eb4cfe65a927d', 'Launch Form 1', 'input', 'house_no_srch', 'House No', '63eb4cfe6600290', '70', '108', '127', '200', '22', '1', 'left', '0', '0', '0', NULL, NULL, '', '', '', '', '', NULL, NULL, '', '', '', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '', 'text', NULL, '', NULL, 'search-field', '0', '', '', '', '', '', '', '', NULL, NULL ); 

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66b50c9', '63eb4cfe65a927d', 'Launch Form 1', 'input', 'road_name_srch', 'Road Name', '63eb4cfe6600290', '80', '140', '127', '200', '22', '1', 'left', '0', '0', '0', NULL, NULL, '', '', '', '', '', NULL, NULL, '', '', '', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '', 'text', NULL, '', NULL, 'search-field', '0', '', '', '', '', '', '', '', NULL, NULL ); 

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66c3fa8', '63eb4cfe65a927d', 'Launch Form 1', 'input', 'postcode_srch', 'Postcode', '63eb4cfe6600290', '90', '172', '127', '200', '22', '1', 'left', '0', '0', '0', NULL, NULL, '', '', '', '', '', NULL, NULL, '', '', '', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '', 'text', NULL, '', NULL, 'search-field', '0', '', '', '', '', '', '', '', NULL, NULL ); 

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66c70bf', '63eb4cfe65a927d', '', 'run', 'iframe_proplist', 'Property List', '63eb4cfe6600290', '30', '14', '344', '1000', '500', '1', 'left', '0', '0', '0', NULL, NULL, NULL, NULL, '63e6143c4903290', NULL, 'i', '', 'F', NULL, NULL, NULL, '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, '', NULL, NULL, NULL, NULL, '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); 

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66c99cf', '63eb4cfe65a927d', '', 'input', 'btn_searchprops', 'Search', '63eb4cfe6600290', '20', '211', '128', '80', '22', '1', 'left', '0', '0', '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, 'button', NULL, NULL, NULL, '', '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); 

INSERT INTO zzzzsys_object (zzzzsys_object_id, sob_all_zzzzsys_form_id, sob_all_table, sob_all_type, sob_all_id, sob_all_label, sob_all_zzzzsys_tab_id, sob_all_order, sob_all_top, sob_all_left, sob_all_width, sob_all_height, sob_all_cloneable, sob_all_align, sob_all_validate, sob_all_access, sob_all_event, sob_all_style_type, sob_all_style, sob_calc_formula, sob_calc_format, sob_run_zzzzsys_form_id, sob_run_filter, sob_run_method, sob_run_target, sob_run_type, sob_run_id, sob_display_sql, sob_select_multiple, sob_select_2, sob_select_sql, sob_lookup_code, sob_lookup_description, sob_lookup_description_width, sob_lookup_autocomplete, sob_lookup_zzzzsys_form_id, sob_lookup_javascript, sob_lookup_php, sob_lookup_table, sob_subform_zzzzsys_form_id, sob_subform_foreign_key, sob_subform_add, sob_subform_delete, sob_subform_type, sob_subform_table, sob_input_count, sob_input_format, sob_input_type, sob_input_icon, sob_input_javascript, sob_input_datalist, sob_input_attribute, sob_input_file_target, sob_html_code, sob_html_chart_type, sob_html_javascript, sob_html_title, sob_html_vertical_label, sob_html_horizontal_label, sob_image_zzzzsys_file_id, sob_all_json, sob_json) 

VALUES ( '63eb4cfe66cc25e', '63eb4cfe65a927d', '', 'input', 'btn_resetsearch', 'Reset', '63eb4cfe6600290', '10', '211', '224', '100', '22', '1', 'left', '0', '0', '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, 'button', NULL, NULL, NULL, NULL, '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); 


--
-- zzzzsys_event
--

INSERT INTO zzzzsys_event (zzzzsys_event_id, sev_zzzzsys_object_id, sev_event, sev_javascript, sev_json) 

VALUES ( '63eb4cfe6776135', '63eb4cfe66c99cf', 'onclick', 'applySearch();', NULL ); 

INSERT INTO zzzzsys_event (zzzzsys_event_id, sev_zzzzsys_object_id, sev_event, sev_javascript, sev_json) 

VALUES ( '63eb4cfe67779bc', '63eb4cfe66cc25e', 'onclick', '$(\"[search-field]\").val(\'\'); // empty all search fields\napplySearch();\n', NULL ); 
and here's the iframe (frm_proplist)

Code: Select all

-- nuBuilder cloner SQL Dump
-- Version 1.21
-- Generation Time: February 14, 2023 07:58:18 AM

-- Form Description: Property List
-- Form Code: frm_propertylist
-- Form Table: tblProperties
-- Form Type: browse


--
-- zzzzsys_form: frm_propertylist_clone_1
--

INSERT INTO zzzzsys_form (zzzzsys_form_id, sfo_type, sfo_code, sfo_description, sfo_breadcrumb_title, sfo_table, sfo_primary_key, sfo_browse_redirect_form_id, sfo_browse_row_height, sfo_browse_rows_per_page, sfo_browse_title_multiline, sfo_browse_autoresize_columns, sfo_browse_sql, sfo_javascript, sfo_browse_javascript, sfo_edit_javascript, sfo_style, sfo_mobile_view, sfo_json) 

VALUES ( '63eb4d2aaac1271', 'browse', 'frm_propertylist_clone_1', 'Property List', NULL, 'tblProperties', 'idProperties', '', '0', '0', '1', NULL, 'SELECT * FROM #TABLE_ID#\n', NULL, NULL, NULL, NULL, NULL, NULL ); 


--
-- zzzzsys_tab
--

INSERT INTO zzzzsys_tab (zzzzsys_tab_id, syt_zzzzsys_form_id, syt_title, syt_order, syt_help, syt_access, syt_json) 

VALUES ( '63eb4d2aab0f8f0', '63eb4d2aaac1271', 'Main', '10', NULL, NULL, NULL ); 


--
-- zzzzsys_select
--

INSERT INTO zzzzsys_select (zzzzsys_select_id, sse_code, sse_description, sse_json, sse_sql, sse_edit, sse_system) 

VALUES ( '63eb4d2aaac1271_BR', NULL, NULL, '{\"tables\":[{\"id\":\"boxc16760237861661001\",\"position\":{\"top\":25,\"left\":22},\"tablename\":\"tblProperties\",\"alias\":\"\",\"checkall\":true,\"checkboxes\":[false,false,false,false,false,false]},{\"id\":\"boxc16760237893181002\",\"position\":{\"top\":24,\"left\":247},\"tablename\":\"tblRoads\",\"alias\":\"\",\"checkall\":true,\"checkboxes\":[false,false,false,false,false,false]}],\"joins\":{\"field_0_boxc16760237893181002--field_5_boxc16760237861661001\":\"LEFT\"}}', 'SELECT\n tblProperties.*,\n    tblRoads.*\n\nFROM\n    tblProperties\n        LEFT JOIN tblRoads ON tblRoads.idRoads = tblProperties.id_Roads\n', NULL, '1' ); 


--
-- zzzzsys_browse
--

INSERT INTO zzzzsys_browse (zzzzsys_browse_id, sbr_zzzzsys_form_id, sbr_title, sbr_display, sbr_align, sbr_format, sbr_order, sbr_width, sbr_json) 

VALUES ( '63eb4d2aab79e52', '63eb4d2aaac1271', 'Building Name', 'BuildingName', 'l', '', '10', '200', NULL ); 

INSERT INTO zzzzsys_browse (zzzzsys_browse_id, sbr_zzzzsys_form_id, sbr_title, sbr_display, sbr_align, sbr_format, sbr_order, sbr_width, sbr_json) 

VALUES ( '63eb4d2aab7be9a', '63eb4d2aaac1271', 'House No', 'HouseNo', 'l', '', '40', '60', NULL ); 

INSERT INTO zzzzsys_browse (zzzzsys_browse_id, sbr_zzzzsys_form_id, sbr_title, sbr_display, sbr_align, sbr_format, sbr_order, sbr_width, sbr_json) 

VALUES ( '63eb4d2aab7d108', '63eb4d2aaac1271', 'Unit Name', 'UnitName', 'l', '', '30', '150', NULL ); 

INSERT INTO zzzzsys_browse (zzzzsys_browse_id, sbr_zzzzsys_form_id, sbr_title, sbr_display, sbr_align, sbr_format, sbr_order, sbr_width, sbr_json) 

VALUES ( '63eb4d2aab7e253', '63eb4d2aaac1271', 'Unit No', 'UnitNo', 'l', '', '20', '60', NULL ); 

INSERT INTO zzzzsys_browse (zzzzsys_browse_id, sbr_zzzzsys_form_id, sbr_title, sbr_display, sbr_align, sbr_format, sbr_order, sbr_width, sbr_json) 

VALUES ( '63eb4d2aab7f233', '63eb4d2aaac1271', 'Road', 'RoadName', 'l', NULL, '50', '200', NULL ); 

INSERT INTO zzzzsys_browse (zzzzsys_browse_id, sbr_zzzzsys_form_id, sbr_title, sbr_display, sbr_align, sbr_format, sbr_order, sbr_width, sbr_json) 

VALUES ( '63eb4d2aab80356', '63eb4d2aaac1271', 'Parish', 'Parish', 'l', NULL, '60', '70', NULL ); 

INSERT INTO zzzzsys_browse (zzzzsys_browse_id, sbr_zzzzsys_form_id, sbr_title, sbr_display, sbr_align, sbr_format, sbr_order, sbr_width, sbr_json) 

VALUES ( '63eb4d2aab80f4e', '63eb4d2aaac1271', 'Postcode', 'Postcode', 'l', NULL, '70', '50', NULL ); 


--
-- zzzzsys_php
--

INSERT INTO zzzzsys_php (zzzzsys_php_id, sph_code, sph_description, sph_group, sph_php, sph_run, sph_zzzzsys_form_id, sph_system, sph_global, sph_hide, sph_json) 

VALUES ( '63eb4d2aaac1271_BB', '63eb4d2aaac1271_BB', 'System PHP', 'nubuilder', '$filter = \' AND (1 = 1) \';\n\nsetFilter($filter, \'prop_name_fltr\', \'BuildingName\');\nsetFilter($filter, \'unit_no_fltr\', \'UnitNo\');\nsetFilter($filter, \'unit_name_fltr\', \'UnitName\');\nsetFilter($filter, \'house_no_fltr\', \'HouseNo\');\nsetFilter($filter, \'road_name_fltr\', \'RoadName\');\nsetFilter($filter, \'postcode_fltr\', \'Postcode\');\n\nfunction setFilter(&$filter, $filterName, $columnName) {\n    $value = nuGetProperty($filterName);\n    if ($value != \'\') $filter .= \" AND $columnName LIKE \'%$value%\' \";\n}\n$create = \"CREATE TABLE #TABLE_ID# \";\n\n$select = \"\n\nSELECT \n\n    idProperties,\n    BuildingName,\n    UnitNo,\n    UnitName,\n    HouseNo,\n    RoadName,\n    Parish,\n    Postcode\n\nFROM tblProperties LEFT JOIN tblRoads ON tblRoads.idRoads = tblProperties.id_Roads\n\nWHERE (1 = 1)\n\n\" . $filter;\n\n// To output the SQL to nuDebug Results:\nnuDebug($select);\nnuRunQuery($create . $select);\n ', NULL, NULL, '1', '0', NULL, NULL ); 
Thanks so much
kev1n
nuBuilder Team
Posts: 4296
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Guidance needed creating multi-criteria search form with subform

Unread post by kev1n »

This is misspelled:

road_name-srch --> road_name_srch

Code: Select all

    frame.nuSetProperty('road_name_fltr', road_name_srch.value);
You can easily spot these kind of errors by opening the developer console:
If you encounter an issue, be sure to check the developer console for errors by clicking the `F12` key on most browsers.

and I still do not see tblproperties_id in your SQL statement.

Also make sure that the Primary Key (tblproperties_id) is in the SELECT statement.
Keith-i
Posts: 88
Joined: Wed Jan 18, 2023 3:03 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Guidance needed creating multi-criteria search form with subform

Unread post by Keith-i »

Fantastic! That one typo was the problem. Thank you so much for your perserverence with helping me.

Incidentally, there is no field/primary key named tblproperties_id. The only primary key in the tblProperties table is idProperties which is included in the SELECT statement.

I can now move on to the next stage. I need to be able to click on/select a result in the iFrame table which will then show me related data about that property such as the dates we have surveyed it. Do I achieve this with a subform? This data will come from a related table named tblInstructions.
kev1n
nuBuilder Team
Posts: 4296
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Guidance needed creating multi-criteria search form with subform

Unread post by kev1n »

If the related data does not need to be changed, you could display it in another Browse Form when a row is selected. Otherwise use a subform.
Keith-i
Posts: 88
Joined: Wed Jan 18, 2023 3:03 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Guidance needed creating multi-criteria search form with subform

Unread post by Keith-i »

Thanks. It will just be for browsing data so a browse form should be fine. Do I create another iFrame on the same tab to show this related data? And how do I get this new browse form to show the related data. Is there some method or code I need to get it to update the browse forms SQL query when I click on a row in the main form.
kev1n
nuBuilder Team
Posts: 4296
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Guidance needed creating multi-criteria search form with subform

Unread post by kev1n »

Would it be an option to display the data in a popup form? I think it's easier than opening a new tab or loading a new browse form in the existing browse form and having to navigate back again.
Keith-i
Posts: 88
Joined: Wed Jan 18, 2023 3:03 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Guidance needed creating multi-criteria search form with subform

Unread post by Keith-i »

I guess so. For each entry in the parent form there are two subsets of data to display. I'll send you a screen shot of my existing Access database by PM so you get the idea.
Post Reply