• Resolved charlesgodwin

    (@charlesgodwin)


    The legacy Table Builder supported the use of adding a query string to the URL so the page would load with prefiltered records. The construct was ?wpda_search_column_xxxxx where xxxxx was the column name. Multiple column. It is described here

    Is this possible with Application Builder?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Kim L

    (@kimmyx)

    Hi @charlesgodwin,

    Sorry for the late response.

    Yes, this is also possible (and better) with the App Builder.

    You can read more here: URL parameters | WP Data Access

    You add these filters to Table Builder > Default Where field.

    See here: Default where | WP Data Access

    Let us know if you have more questions. ??

    Thread Starter charlesgodwin

    (@charlesgodwin)

    I don’t consider (and better) is applicable in our application.

    We have a site that optionally allows a user to pre-fill first and last name and then get sent to our search page. This is the URL to that page for John Smith. This uses the query string convention described in my original email.

    Then, optionally, a user can access our same search page with no query string, like this, and have full search access. We allow them to switch by reloading the page without the query string.

    A default where clause would be difficult in this use case

    Can I conclude from your reply that the answer to my question is no?

    Hello,

    I have a question which is ( I think! ) related to the issue that Charles has raised.

    I have a page with a tabular view of the contents of an SQL view from one table, with a field which contains a URL link to a detail view of the corresponding data record. The format is :-

    https://dev.bristol-re.co.uk/owner-details/?wpda_search_column_owner_id=1

    I have tested it in the new App Builder and Data Explorer ( also new ), the link functions correctly, and opens the relevant page. However, in the browser, the URL is displayed as plain text, and does not function as a link.

    The link field is set to plain text, not hyperlink – this generally functions correctly ( in the old Data Explorer, etc, )

    Thanks in advance for your help.

    Nigel

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi guys,

    I think the underlying question is: can we create a search form with the App Builder? Right?

    Short answer: YES

    Long answer:

    First, create a search form as you did with the old Table Builder. The old Table Builder required a specific parameter name format, as Charles mentioned. This is not necessary with the App Builder. You can give your parameters any name.

    Next, open the where clause section in the Table Builder and use your parameters using one of the variables as mentioned on this page:
    https://wpdataaccess.com/docs/table-builder-filters/code-url-parameters/

    Here is an example of a where clause using HTTP POST:
    student_id = httpPost[‘student_id’] and httpPost[‘student_id’] is not null

    And the same example using HTTP GET:
    student_id = httpGet[‘student_id’] and httpGet[‘student_id’] is not null

    For this example, your search form would contain an input field named student_id.

    Please be aware that the URL parameter values return a null value if it is not found.

    Does this help?
    Peter

    Hello Peter,

    Thanks for your help.

    I am trying to implement the approach that you described, based on the pages that I have already created.

    Firstly, I have a page "Search for owners" which uses the publication-search-form model to populate the fields, and submit the query. This has four fields, but I am only using the owner_name field for this test. In the "old" publication-search-form this is defined as "wpda_search_column_owner_name".

    In the App Builder, I have an app named "Owner list". I run this app in the App Builder, and select "Table Builder". I have tried various versions in the "Default where" clause setting, but without success

    If I use? "where owner_name = $wpda_search_column_owner_name" in the "Default where" clause,? then I see this message on the results page:-

    "Unknown column '$wpda_search_column_owner_name' in 'where clause'"

    I have also tried this clause, but similarly without success:-


    owner_name like httpGet['owner_name']

    I have also tried various combinations, as shown in the explanatory notes, but without success. The only version that gives correct results is one such as this:-

    owner_name like "Frampton"
    OR owner_name like "Red%"

    This one does show the correct results, but the URL field is still not clickable.

    Please note that the dev.bristol-re.... site is password-protected - please let me know if you need to run any tests.

    Thanks in advance for your help.

    Nigel
    Plugin Contributor Kim L

    (@kimmyx)

    Hi @rc169,

    I created a demo for you here (using the old search form sample): https://share.zight.com/6quAve56

    If you have more questions, you can send us a message via Contact | WP Data Access.

    Hope this helps! ??

    Hi Kim,

    Thanks for your message and the video. I have tested that setting on my site, and it now functions correctly.

    I presume that the same configuration can be used for multiple input fields, which may or may not be populated, with a suitably amended “where” clause? I will do some more testing to see if I can generate a suitable clause.

    The only outstanding issue is the question of whether the URL field functions as a link – should I raise a separate topic, as I realise that it is not quite the same question that Charles raised?

    Thanks again for your help.

    Nigel

    Hi Kim,

    To avoid the complication of catering for possibly empty fields in the “publication-search-form”, I have added a default “%” sign as a value parameter to the <input> line(s) of the code – e.g.:-

    <input type="text" id="wp_owner_name" name="wp_owner_name" value="%" />

    The “default where” is then quite simple:-

    owner_name like httpGet[‘wp_owner_name’]

    The behaviour is then correct, regardless of whether the user enters a value in the box to replace the % sign, enters additional text beside the %, or leaves it untouched. Of course, if the user removes the % sign, but doesn’t enter anything to replace it, then I suppose it will fail – but that’s not a very sensible choice!

    However, the outstanding question is how to cater for multiple entry fields on the publication-search-form? I have not yet found the appropriate “where” clause for that requirement – but it is handled very satisfactorily on the old version.

    Any suggestions gratefully received!

    Thanks,

    Nigel

    Plugin Contributor Kim L

    (@kimmyx)

    Hi @rc169,

    The Default WHERE clause accepts multiple URL parameters using the AND operator.

    For example: book_id = httpGet[‘bookid’] and book_genre = httpGet[‘bookgenre’]

    In the latest version 5.5.32, Peter added the ability to return all results when the field is submitted blank or null.

    The Default WHERE clause would look like: (book_id = httpGet[‘bookid’] or httpGet[‘bookid’] is null) and (book_genre = httpGet[‘bookgenre’] or httpGet[‘bookgenre’] is null)

    If you have more questions, please create a new thread or send us a message via Contact | WP Data Access. ??

    • This reply was modified 1 month ago by Kim L.
Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.