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

using list populate and search together

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

    using list populate and search together

    I'm looking for a way to combine the JSON populate technique with a list search.

    We have a history of over 7000 inspections with about 1000 active at any one time. Our app design is to start with a searchable list (in a list control), select a project, then go to other areas to work on it. But, obviously, it takes way to long for a list of 7000 projects to get formatted and listed. We have identified 15 fields that are important to be able to search on, and that search needs to include all jobs in the history. So, we use an Xbasic callback and the "populate" technique to assemble the list in JSON and that is good for up to 500 projects in an acceptable time.
    We have hit on the following layout:
    list_search.png
    In the upper right corner of the pic, the user selects a list type, such as work list, full list, active only, etc. and a record limit, gets the list, then does the search. But, of course, the search only searches the list selected.

    I'm looking for a way to combine the list search with the list type and do them together.

    Thanks.
    Pat Bremkamp
    MindKicks Consulting

    #2
    Re: using list populate and search together

    Is the List Type and Record Limit Server-side?
    And the Search Client-Side?

    Comment


      #3
      Re: using list populate and search together

      Yes, the list type and record limit are in an Xbasic callback called in the onChange event of the list type dropdown. I've tried the search both ways...currently set to server side. In the grid there are onSearch and beforeSearch events but I can't find those for the list control.
      Last edited by Pat Bremkamp; 10-15-2017, 09:42 AM.
      Pat Bremkamp
      MindKicks Consulting

      Comment


        #4
        Re: using list populate and search together

        and that search needs to include all jobs in the history
        So the search needs to go against the 7,000 inspections.

        Do you want to search against 7,000 inspections and then, from those results, select a subset based on List Type and record limit?

        Comment


          #5
          Re: using list populate and search together

          Yes ... you are better at explaining it than I am!

          I suppose that I could get the search values using e.dataSubmitted and add them to the sql in the callback, but I was hoping to avoid all that code if Alpha has already done the work.

          Pat
          Pat Bremkamp
          MindKicks Consulting

          Comment


            #6
            Re: using list populate and search together

            I think you could use this... have a look at the optional Xbasic function...

            https://www.alphasoftware.com/docume...t%20Method.xml

            Since you're using Server-side search, you can include an Xbasic function in .searchList()

            Your List Search definition and details are in e.searchDefinition.

            All your Search Controls and values... and UX Detail View Controls and values... are in e.tmpl.request.Variables.V.R1.

            If you wanted to use State Variables... they'd be found in e.tmpl.request.Variables._state.

            Once you're in your Xbasic function... you can adjust the filter in e.searchDefinition... adding in your List Type criteria, row limit, etc... and the rows returned will reflect everything you've set.
            Last edited by Davidk; 10-15-2017, 02:09 PM.

            Comment


              #7
              Re: using list populate and search together

              That looks very promising if I can get it to work. Right now, I click the button and nothing appears to happen. It does not appear that the Xbasic function is getting called.

              The only place I see the .searchList() function is in the onClick event of the "search" button. So, I set it up this way:
              {dialog.object}.getControl('JOBLIST').searchList({searchMode:'serverSide',xbasicAfterFilterCompute:"pickListType"});

              Right now, I'm just trying to look at the alpha search definition so I can figure out how to include it. My Xbasic function is
              function pickListType as v (e as p)
              ... some stuff ...
              dim alphaFilter[0] as p = e.searchDefinition
              dim sql as C
              sql = e._state.basesql 'from onDialogInitialize
              dim json as c
              json = ""
              dim js as c
              js = ""
              dim typePicked as C = alltrim(e.dataSubmitted.listType)
              select
              case typePicked = "SJ" 'selected job
              sql = sql + "WHERE p.PROJECT_NUMBER = :argJobno "
              case typePicked = "WL" 'employee work list
              sql = sql + "WHERE p.ASSIGNED_EMPLOYEE = :argULINK "
              sql = sql + "AND p.CURRENT_ACTIVITY BETWEEN 10 AND 82 "
              sql = sql + "ORDER BY p.PROJECT_NUMBER "+sd+" LIMIT :argLimit"
              case typePicked = "FL" 'full list
              sql = sql + "ORDER BY p.PROJECT_NUMBER "+sd+" LIMIT :argLimit"
              case typePicked = "AA" 'all active
              sql = sql + "WHERE p.CURRENT_ACTIVITY BETWEEN 10 AND 82 "
              sql = sql + "ORDER BY p.PROJECT_NUMBER "+sd+" LIMIT :argLimit"
              case typePicked = "CA" 'client can work on these
              sql = sql + "WHERE p.CURRENT_ACTIVITY IN (23,70,81) "
              sql = sql + "ORDER BY p.PROJECT_NUMBER "+sd+" LIMIT :argLimit"
              case typePicked = "AN" 'active and has advise or deficient items
              sql = sql + "WHERE p.CURRENT_ACTIVITY BETWEEN 10 AND 82 "
              sql = sql + "(SELECT COUNT(*) FROM project_lines l WHERE l.PROJECT_NUMBER = p.PROJECT_NUMBER AND l.LINE_STATUS IN ('Advise','Deficient')) > 0 "
              sql = sql + "ORDER BY p.PROJECT_NUMBER "+sd+" LIMIT :argLimit"
              case else
              hasError = .t.
              errorMsg = "Could not change list type"
              end select
              if hasError = .F.
              if cnx.open("::name::nfn")
              if cnx.execute(sql,args)
              crs = cnx.ResultSet
              json = crs.ToJSONObjectSyntax()
              json = strtran(json,crlf(),"," + crlf())
              json = "[" + rtrim(json,",") + "]"
              js = "var lObj={dialog.object}.getControl('JOBLIST');"+crlf()
              js = js+"var _data="+json+crlf()
              js = js+"lObj.populate(_data);"
              cnx.FreeResult()
              else
              hasError = .T.
              errorMsg = "Could not execute query"
              end if
              cnx.close()
              else
              hasError = .T.
              errorMsg = "Could not connect to the database"
              end if
              end if
              if hasError = .F.
              pickListType = js
              else
              pickListType = "alert(errorMsg);"
              end if
              end function
              Pat Bremkamp
              MindKicks Consulting

              Comment


                #8
                Re: using list populate and search together

                Could not access the Xbasic function for some reason, so I switched the search button to call the callback function, got the search values there, built the where clause, run the sql and it is working.
                Pat
                Pat Bremkamp
                MindKicks Consulting

                Comment


                  #9
                  Re: using list populate and search together

                  Well duh! That feature is not available until release 4642. I'm not on that release yet!
                  Pat Bremkamp
                  MindKicks Consulting

                  Comment

                  Working...
                  X