• Resolved alainmartel

    (@alainmartel)


    Hello.
    Is it possible to use a target table value to display table results in the front and back end?
    I a scenario where I need to display the today’s customers (or students) presence in a class.
    I have a customers table with columns “myid””name” and “program”,
    Also have an entries table with columns “entid””cusid” and “enttimestamp”
    The “entries.cusid” is the “customers.myid”
    Can I display, in the main page, all the TODAY entries in class WHERE “customers.program” value = “skk”?

    Thank you.

    Alain Martel

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Alain,

    If I understand your question correctly, I think you might be able to fix this with a subquery. The subquery can be added to your default where clause and check todays date.

    The link you added does not work for me. Can you fix that? That might help to get a better understanding of this issue.

    Thanks,
    Peter

    Thread Starter alainmartel

    (@alainmartel)

    Hello Peter!
    Thanks for the fast reply.
    The problem is not the “today” criteria. This works fine. So I just removed it to avoid confusion.
    My problem is the program = “skk” criteria.
    It works in the query builder. Here’s the query:

    SELECT kwc_entries.entid, kwc_customers.fname, kwc_entries.enttimestamp, kwc_customers.program
    FROM kwc_customers LEFT JOIN kwc_entries ON kwc_customers.myid = kwc_entries.cusid
    WHERE (kwc_customers.program)=”skk”

    But I need this to display on a page at the front end.

    The testing front page is : https://kempocan.com/whitecrane/entries-of-skk/

    Again thanks.

    Alain Martel

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Alain,

    One way to solve this issue is to create a view for your query like this:

    CREATE VIEW skk_view AS
    SELECT kwc_entries.entid, kwc_customers.fname, kwc_entries.enttimestamp, kwc_customers.program
    FROM kwc_customers LEFT JOIN kwc_entries ON kwc_customers.myid = kwc_entries.cusid
    WHERE (kwc_customers.program)= 'skk'

    You can execute the create view statement in the Query Builder. After creating view skk_view you can use it in a publication and add your publication to the front end with a shortcode. You can use views in the Data Publication just like tables.

    Does this help?
    Peter

    Thread Starter alainmartel

    (@alainmartel)

    Hi Peter.
    This helps allot! It works great and will give me allot of usefull options ??
    I’m impressed by your service and your plugin.
    Many thanks!!!

    With high regards,

    Alain Martel

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using a target table value as a condition’ is closed to new replies.