Okay
  Public Ticket #2158821
Use Placeholder %Var1% as a filter above table
Closed

Comments

  •  1
    Jon Falcone started the conversation

    Hi, 

    I am trying to display a table that is powered by a SQL query.


    Right now that SQL query is using %Var1% in the 'WHERE' clause.


    I am wondering if I can display a filter that the user can use that changes the value in %Var1% in that SQL query.


    To be more clear, in the picture I attached..... that is currently the value that is being used in the WHERE clause of the SQL query and it be great if the user can see a filter where they can change that value so the table then filters accordingly.


    Thanks for any help!!!

  •  2,498
    Aleksandar replied

    Hello Jon.

    Well, you can use placeholders as a pre-defined filtering value. 

    So, in the query you'd remove the WHERE clause and %VAR1%, and then:

    1. Go into column settings, navigate to Data tab and change type from Integer to String; hit Apply

    2. Go back into column settings, navigate to Filtering tab, and change the filter type to either text, or select box, or whatever you like (except for numbers - float or integer). Then, under Predefined values type in %VAR1% and that column will be prefiltered with "8473507", but people can change it if they want.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables