Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

_filterList sintax in AfterSelect Javascript of Edit-Combo List

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

    _filterList sintax in AfterSelect Javascript of Edit-Combo List

    Hi! Coming from the xBase line of dBASE, Clipper, Foxpro, VFP programming, so javascript and webdev is new to me.
    I'm hoping someone will point out what am I doing wrong with a simple task of filtering out a list after a value in a textbox (edit-combo list type) is being selected.
    I'd like to avoid using a Search button, which works fine in filtering the list after. I tested invoking that code from AfterSelect (and OnSelect) with {dialog.object}.buttonClick('BUTTON_3'); . It works too, but for some reason not the first time I select a value.
    So, back to the initial idea of the filtering with javascript command right from AfterSelect in the Lookup definition:

    Using the latest update.

    Works:
    {dialog.object}._filterList('list2','prod_cat = "207 "');

    Does not work (after "207 " row is selected):
    var a;
    a = this.value;
    alert(a); // this messagebox comes up fine
    {dialog.object}._filterList('list2', 'prod_cat = :a');

    No surprise, this does not work either:
    var a;
    a = "207 ";
    alert(a); // this messagebox comes up fine
    {dialog.object}._filterList('list2', 'prod_cat = :a');


    I tried multiple combinations of the second part of that command, at no avail. Am I missing something in defining the parameters in _filterList?
    I see there's a filterExpn,orderExpn,filterParameters,havingExpn in the syntax. Maybe put a placeholder there, empty quotes?

    Thanks in advance!
    Last edited by simeatan; 12-10-2015, 03:28 PM.

    #2
    Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

    Code:
    var a;
     a = this.value;
     alert(a); // this messagebox comes up fine
     {dialog.object}._filterList('list2'), 'prod_cat = ' + a);
    or
    {dialog.object}._filterList('list2'), 'prod_cat =" + a + " ' );
    I don't have version 12, but this is how you will normally replace the any item with a variable, try and see if this works.
    Last edited by GGandhi; 12-10-2015, 01:21 PM.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    [email protected]
    Skype:[email protected]
    1 914 924 5171

    Comment


      #3
      Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

      Gandhi,
      Thanks for your reply - Sorry I had an extra ")" in the previous edit of my post. I tried the suggested syntax. No luck yet.

      Comment


        #4
        Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

        Have a look at the _filterList example in the List methods inline doc. In one of your examples you were trying to use an argument, but not supplying the value for that argument. I'm not sure what your posted example syntax was, but the posted solution syntax was incorrect.

        If you'd like to use arguments, then you can do this... (change my 'CUSTOMER_ID' to your field name... you get the idea). This code has been tested. This code is called in the onSelect event of a Textbox control set up as an edit-combo.

        Here we are setting up a parameter string to feed into your argument. The argument is specified by the : in front of what name you'd like - it can be any meaningful text - it doesn't have to match the column name. The params string is passed into the method.

        Code:
        var params = this.value + '|||N|whatId';
        {dialog.object}._filterList('LISTCUST','CUSTOMER_ID = :whatId','',params);
        The sample code in the inline doc is...

        Code:
        //use \n to create a cr-lf delimited list
        //var params = 'Boston|||C|whatcity\nSmith|||C|whatname';
        //{dialog.object}._filterList('MYLIST1','city = :whatcity AND name = :whatname','',params);
        The example is using 2 arguments. You can see that a value, 3 pipes, a type, a pipe, and a name is supplied for each argument section. In your case, for 1 argument, it would be...
        Code:
        var params = this.value + '|||N|procCat';
        {dialog.object}._filterList('LISTCUST','prod_cat = :prodCat','',params);


        Or... you don't have to use an argument. You can add the supplied value to the 2nd parameter of the _filterList method.

        Code:
        {dialog.object}._filterList('LISTCUST','CUSTOMER_ID = ' + this.value);
        Last edited by Davidk; 12-10-2015, 10:19 PM.

        Comment


          #5
          Re: _filterList syntax in AfterSelect Javascript of Edit-Combo List

          David, thanks for your input. I tried the last line of code but it shows an empty list now. I don't need any (extra) parameters in the js code, or passing values to xbasic. Just failing to see what's the difference, or my mistake in the syntax. Looks so basic, no pun intended. It works fine with a button that filters/searches.
          1) {dialog.object}._filterList('list2','prod_cat = "207 "'); // works

          and

          2)
          var a;
          a = "207 ";
          {dialog.object}._filterList('list2','prod_cat =' + a); // not working

          I'm attaching two screenshots. Thanks again!

          lookup1.jpglookup2.jpg

          Comment


            #6
            Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

            {dialog.object}._filterList('list2', 'prod_cat =\"" + a + "\" ' );
            may be this?
            thanks for reading

            gandhi

            version 11 3381 - 4096
            mysql backend
            http://www.alphawebprogramming.blogspot.com
            [email protected]
            Skype:[email protected]
            1 914 924 5171

            Comment


              #7
              Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

              Gandhi,
              I just tried both
              {dialog.object}._filterList('list2', 'prod_cat =\"" + a + "\" ' );
              and
              {dialog.object}._filterList('list2', 'prod_cat ="\" + a + "\" ' );

              , getting this error message in the empty list.

              ['Error.No such field']

              Comment


                #8
                Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

                Hi guys. Just a quick update/conclusion: I ended up creating a javascript action and and doing runaction it in the AfterSelect place.
                A regular "Filter Records in a List Control" did the trick, instead of a _filterList command. Still puzzling, but not the only thing that puzzles me in programming and life. Or the world, for that matter. Thanks for your help - I appreciate it!

                Comment


                  #9
                  Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

                  Now that I know you're working with DBF tables, it makes sense. You should try to specify your Alpha build and data source when posting... it helps.

                  Working with a DBF table, this does not work... (it works using SQL)

                  Code:
                  var a;
                  a = "00000004";
                  {dialog.object}._filterList('LISTCUST','CUSTOMER_ID = ' + a);
                  This does work...

                  Code:
                  var a;
                  a = "00000004";
                  {dialog.object}._filterList('LISTCUST','CUSTOMER_ID = "' + a + '"');
                  And so... this works...

                  Code:
                  {dialog.object}._filterList('LISTCUST','CUSTOMER_ID = "' + this.value + '"');

                  Comment


                    #10
                    Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

                    Thanks a lot, David - I tried the code you supplied (with this.value) and works like a charm!
                    My apologies I forgot to mention I work with the existing DBFs during their transition to mysql.
                    A big lesson I learned from this: syntax and using quotes in the interpreting of dbf and sql table fields is different, in a same command. Have a great weekend!

                    Comment


                      #11
                      Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

                      Excellent... glad to hear it worked out... and that you were able to find another way to get this done... one of Alpha's many strengths.

                      Comment


                        #12
                        Re: _filterList sintax in AfterSelect Javascript of Edit-Combo List

                        So true - although sometimes (me, the ungrateful) wishes I wasn't given more than one choice. That'd force me to look for the best way, the only one. Of course, the other side of the coin is that in different situations we need a different code to employ. The beauty of many ways around. The beauty of Alpha too, I agree.
                        Last edited by simeatan; 12-11-2015, 12:46 PM.

                        Comment

                        Working...
                        X