Announcement

Collapse
No announcement yet.

Searching function problem

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

  • Searching function problem

    Hi!
    I am trying to use the search function of a grid application,
    but then I found out that I cannot search those field that does not exist in the original table.
    For example, I created a field Dpt.Name with a grid lookup in order to retrieve a field from the other table:

    Grid of Table A:
    Name | Dpt.Code | Dpt.Name

    Grid of Table B:

    Dpt.Code | Dpt.Name

    But then when I use the search function on that grid of Table A, I found out that I cannot search those records by typing Dpt.Name,
    also if I try to perform a dynamic search on Dpt.Name, a error message will popup:
    Capture.PNG


    Is there any way to perform searching on fields that doesn't belong in the orignal table?

  • #2
    Originally posted by Brian View Post
    Is there any way to perform searching on fields that doesn't belong in the orignal table?
    Yes, but not what you like ... You must create a new (hidden) field for the full Dpt.Name and fill this field at event onRecord.
    Best regards: - Reinhard -

    I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

    Comment


    • #3
      Originally posted by RHS View Post
      Yes, but not what you like ... You must create a new (hidden) field for the full Dpt.Name and fill this field at event onRecord.
      I did that too,by using something like this:
      $id={id};
      $sql="SELECT contact_name
      FROM supplier_contact
      WHERE supplier=".$id;
      sc_lookup(ds,$sql);
      {contact}={ds[0][0]};

      but that when type in a contact_name exist in one of those fields to search, no result is shown in the quick search,
      and there is still an error message pop up if I use dynamic search.

      Comment


      • #4
        Have you included the contact field in the field list for quicksearch and select a search criteria (scroll down ...)?
        Best regards: - Reinhard -

        I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

        Comment


        • #5
          Originally posted by RHS View Post
          Have you included the contact field in the field list for quicksearch and select a search criteria (scroll down ...)?
          Yes, but the searching still won't work

          Comment


          • #6
            Ah, is see .. report this as bug: a manuell included field(name) is not included in the sql search condition via quick search.
            Best regards: - Reinhard -

            I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

            Comment


            • #7
              Think it through, it can't work because you cannot search for something that doesn't exist in the record set.

              To make it work you have to either create a view and base the grid on it or join the tables in the SQL statement of grid A.

              SELECT name, deptcode, deptname FROM table_a a LEFT OUTER JOIN table_b b ON a.deptcode = b.deptcode

              That should do it.

              jsb

              Comment


              • #8
                I had the same issue with one of our projects and I had to create a view in MySQL then I could search/sort how I wanted.

                Dave
                Dave Prue
                Code Whisperer
                Lahar International Corp
                www.lahar.net

                Comment


                • #9
                  Hi Brian,
                  I agree with JSB. Move that within the SQL using the right Join type.

                  Comment


                  • #10
                    Originally posted by jsbinca View Post
                    Think it through, it can't work because you cannot search for something that doesn't exist in the record set.
                    Yes, you are right ... Thanks!
                    Best regards: - Reinhard -

                    I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

                    Comment

                    Working...
                    X