Announcement

Collapse
No announcement yet.

New button to change SQL in realtime

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by jsbinca View Post
    Hi,
    I suggest you use two buttons: 'Show all' and 'Show latest' to be able to switch back and forth.

    In SQL -> Where Condition: [glo_where] //global variable that contains your where clause.

    In onScriptIni:
    if(!isset([glo_where])) //to make sure we have a valid where clause
    {
    [glo_where] = '1 = 1';
    }

    Code for 'Show latest' button:
    [glo_where] = "the where clause to show the latest addresses";
    sc_redir(hcm_person_address,glo_where=[glo_where],'_self'); //call the form itself with the new where clause

    Code for 'Show all' button:
    [glo_where] = "1 = 1";
    sc_redir(hcm_person_address,glo_where=[glo_where],'_self');

    In the onLoad event you can hide and show the correct button depending on your [glo_where] variable.


    Hope this helps.
    jsb
    hi jsb,

    i realize there is a bug if i try to manipulate the search, the rows reduced (since i only retrieve latest rows), it returned only 3 rows but end up the pagination ([1 to 3 of 6]) doesn't update and confused the pages are incorrect
    Attached Files

    Comment


    • #17
      Hi,
      it'll be most likely your SQL statement(s). Did you try it on your database to see if it returns the correct records?.

      jsb

      Comment


      • #18
        Yup, the SQL is absolutely correct
        That's why the row reflected only the latest row for each address type.

        but it seems like a SC bug for me coz it's only the pagination not working

        Comment

        Working...
        X