Title: Help with WPDataAccess
Last modified: March 15, 2023

---

# Help with WPDataAccess

 *  Resolved [dwmilli99](https://wordpress.org/support/users/dwmilli99/)
 * (@dwmilli99)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/help-with-wpdataaccess/)
 * I am trying to write code snippet using wpcode to generate and execute a wpdataaccess
   shortcode based on the value of a variable. I can get the code to generate the
   shortcode and it prints out on the page, but doesn’t get executed. Perhaps, there
   is a better way to approach this issue.
 *     ```wp-block-code
       Here is the CODE snippet executing as javascript:   
   
       	src="//code.jquery.com/jquery-1.12.0.min.js"
       	type="text/javascript"
   
       	const queryString = window.location.search;
       	console.log(queryString);
       	const urlParams = new URLSearchParams(queryString);
       	const stage_passed = urlParams.get('url_stage')
       	console.log("stage passed is: " + stage_passed);
   
       // code I am testing
       //  
         function getParameterByName( name ){
         name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
         var regexS = "[\\?&]"+name+"=([^&#]*)";
         var regex = new RegExp( regexS );
         var results = regex.exec( window.location.href );
         if( results == null )
           return "";
         else
           return decodeURIComponent(results[1].replace(/\+/g, " "));
       }
       //
       	const stage2_passed = getParameterByName('url_stage');
       	console.log("stage 2 passed: " + stage2_passed);
       //
       	sessionStorage.setItem("url_stage", stage2_passed);
       	const stage3_passed = sessionStorage.getItem("url_stage")
       	console.log("session storage contents of url_stage:  " + stage3_passed);	
       //
       //
       // code to set correct shortcode for table processing
       //
       //
       	const stage_to_use = sessionStorage.getItem("url_stage")
       //	var stage_1 = [wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="1,y"];
       //	var stage_2 = [wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="2,y"];
       //	var stage_3 = [wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="3,y"];
       //	var stage_4 = [wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="4,y"];
       //	var stage_5 = [wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="5,y"];
       //
       	if (stage_to_use == "1") {
       	  	document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="1,y"]);
       	};
       	if (stage_to_use == "2") {
       	  	document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="2,y"]);
       	};
       	if (stage_to_use == "3") {
       		document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="3,y"]);
       	};
       	if (stage_to_use == "4") {
       	  	document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="4,y"]);	
       	};
       	if (stage_to_use == "5") {
       	 	document.write([wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="5,y"]);	
       	};
       	console.log("ERROR - stage_to_use is not between 1-5");
   
   
       Here is the output:
   
       Below generated by code snippet, but need it to execute too.  This shows where it should on the page.
   
       [wpdataaccess pub_id="1" filter_field_name="stage,input" filter_field_value="4,y"]
       ```
   
 * email is: [dwmilli@gmail.com](https://wordpress.org/support/topic/help-with-wpdataaccess/dwmilli@gmail.com?output_format=md)
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhelp-with-wpdataaccess%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Kim L](https://wordpress.org/support/users/kimmyx/)
 * (@kimmyx)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/help-with-wpdataaccess/#post-16567041)
 * Hi [@dwmilli99](https://wordpress.org/support/users/dwmilli99/),
 * Shortcode parameters are available for shortcode `wpdadiehard` only.
 * More information here: [Adding filters | WP Data Access](https://wpdataaccess.com/docs/data-apps-advanced-features/adding-filters/)
 * An option for you would be to create your table as a page in a [project](https://wpdataaccess.com/docs/data-apps/projects-and-templates/).
 * Let us know if that works for you. 😊

Viewing 1 replies (of 1 total)

The topic ‘Help with WPDataAccess’ is closed to new replies.

 * ![](https://ps.w.org/wp-data-access/assets/icon-256x256.png?rev=3299063)
 * [WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards](https://wordpress.org/plugins/wp-data-access/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-access/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-access/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Kim L](https://wordpress.org/support/users/kimmyx/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/help-with-wpdataaccess/#post-16567041)
 * Status: resolved