New call-to-action
Results 1 to 29 of 29

Thread: A5W Page Filter and Order Syntax

  1. #1
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default A5W Page Filter and Order Syntax

    I want to modify my URL to filter a UX component.

    I found this documentation, which seems to get at what I am trying to do, but it is very dated, and not for version 12.

    http://support.alphasoftware.com/MyS...ter_Syntax.htm

    Any way to do this is v12? Anybody have a document to share? Or would know what the proper syntax would be?

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,907

    Default Re: A5W Page Filter and Order Syntax

    It's a bit hard to understand what you'd like to do here. Not sure what you mean by modify your URL.

    Do you want to process Request Variables passed in via your URL when your UX opens in order to filter a data bound UX component?

  3. #3
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Yes, what you said.

    If a user is on the desktop, they will start on this page:

    https://snap.scansourcesecurity.com/sales_map.htm

    For mobile app, I'll build a page with a dropdown of states.

    But basically, select a state, and the same UX component you were helping me with:

    https://snap.scansourcesecurity.com/sales.a5w

    would filter to show only sales reps in that state.


    I have a field named "Region" in my table that has state abbreviations. So I'm not sure if it is best to modify the URL as I stated above. So maybe if they click on Texas, it would just be a URL that looks like this:

    https://snap.scansourcesecurity.com/...lter=Region=TX

    Although I don't think that syntax is correct for v12, and not sure if this is even the way to do this in v12.

  4. #4
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,907

    Default Re: A5W Page Filter and Order Syntax

    Could you post your sales_map component / page? That will help.

    For mobile, you don't want to open another page... just another panel containing your sales info.

    I might do the same for a web page... use panels inside a page and just transition from the map to the sales list.

  5. #5
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    I am attaching my sales map. It's not an .a5w component file though, just .htm

    It probably will look ugly if you import it into Alpha Five.



    sales_map.zip

  6. #6
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Nobody has any ideas on this? I have a non-alpha webpage where you can click on a state to trigger a URL. I can make the URL for each state anything I want. I ultimately want all URLs to point to the same UX component. The UX component has a list with a bunch of sales people in it. I want to filter that list based on the URL, to show only sales reps in that state. Can that be done this way? Or is there a better way? (keeping in mind that the map I am referring to is not an alpha component of any kind).

  7. #7
    Member
    Real Name
    Josh Cole
    Join Date
    Jun 2012
    Posts
    678

    Default Re: A5W Page Filter and Order Syntax

    Carl,

    I replied to another one of your posts and laid out for you how to do this.

  8. #8
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Ok, thanks. It didn't fully make sense to me (probably because I am so new at this). I'll look at it again.

  9. #9
    Member
    Real Name
    Josh Cole
    Join Date
    Jun 2012
    Posts
    678

    Default Re: A5W Page Filter and Order Syntax

    I will post a sample ux demonstrating how it works for you.

  10. #10
    Member
    Real Name
    Josh Cole
    Join Date
    Jun 2012
    Posts
    678

    Default Re: A5W Page Filter and Order Syntax

    Here you go Carl

    Be sure to publish all of the files. I included a dbf with some dummy data. To try and mirror your current configuration I created a htm page with a simple select and button with the inline javascript necessary to create the url that will include the request variable. Be sure to open the htm page and start from there once you've published everything.

    This is a very simple example but it demonstrates how it can work as long as you can access the onclick event for when the state is clicked on in your html based map. I feed a request variable to the ux and assign the request variable to a session variable. I use the session variable to filter the list. Look at the Server-Side OnDialogInitialize event for the request variable function.

    I am not suggesting that this is the "best" possible design approach but it does provide you with the information you requested.

    RequestVariables.zip

  11. #11
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Thank you so much! I'll check this out today.

  12. #12
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Josh, your method works great. Thanks for your help with this, I really do appreciate it!

  13. #13
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Hey Josh, any thoughts on if I wanted a sales rep to be assigned to more than one state? Would I need a field for each state, and perhaps a yes or no as the data? Or is there a way I can have a single state field, but have multiple entries?

  14. #14
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    I guess for state, I could do comma separated values: NC,SC,TX, etc. But when I try to filter by SC for example, it doesn't return a field with multiple options, I guess because it is looking for just SC. Wondering if there is a better way.

  15. #15
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,907

    Default Re: A5W Page Filter and Order Syntax

    Have you been able to attach a State click event to the map?

  16. #16
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    I basically followed everything Josh suggested above, with a slight difference on the html map page. His had an onclick event when a state was selected in the dropdown that would match an abbreviation to the state ID. I simply created a URL for each of the 50 states that had the state abbreviation already in it:

    So you click on South Carolina, and this is the link:

    https://snap.scansourcesecurity.com/sales.a5w?state=SC

    I think his javascript was basically doing the same thing based on which drop down you select.


    I have this working great now, and if I click on South Carolina, it takes me to all records where SC is set as the state. My follow up question to that is, what if I have SC, NC, and TX for that record? This method doesn't show records that have multiple entries. Is there a way to tweak this?

  17. #17
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,907

    Default Re: A5W Page Filter and Order Syntax

    That looks good. It's a little bit of work and involves an extra callback... but works nicely.

    Here's a quick video of a UX component using the Raphaeljs library. There's only one onclick event, no callback to set a US State value, and no extra page to call. The List still does a full data refresh once it gets the State value but this could be eliminated as well by just filtering the List client-side. And it even looks good on an iPhone.

    https://youtu.be/rCojg00r_FI

    BTW, the bird you hear in the background is a Mockingbird which was sitting just outside on a branch... what a great voice.

  18. #18
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Interesting. Is there any tutorial anywhere that explains that in more detail? And would it support the multi state scenario I described above?

  19. #19
    Member
    Real Name
    Josh Cole
    Join Date
    Jun 2012
    Posts
    678

    Default Re: A5W Page Filter and Order Syntax

    Carl,

    David is leading you towards a much better long-term solution in my opinion. I've become far too dependent on callbacks when you really are supposed to push as much as you can to the client side and avoid callbacks wherever possible.

    I think as David suggested (and there is probably a better way) you can create a comma separated value for the selected states and your filter would now become instead of state = :state, it would now look something like state IN :state where the value of the argument :state would look like CA,TX,HI

  20. #20
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,907

    Default Re: A5W Page Filter and Order Syntax

    Quote Originally Posted by carlbsmith View Post
    I guess for state, I could do comma separated values: NC,SC,TX, etc. But when I try to filter by SC for example, it doesn't return a field with multiple options, I guess because it is looking for just SC. Wondering if there is a better way.
    Carl, it's a bit unclear what you'd like to do here. You select a State... SC... and get back a list of Sales Reps for SC. You then Select a Sales Rep and transition to that person's info. In that info, do you also want to see a list of other States that person is a Sales Rep for?

  21. #21
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    I guess what I am trying to say is that a sales rep might cover multiple states. So John Smith might cover North Carolina and South Caroline. I need his name to come up when I click on either of those states.

  22. #22
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,907

    Default Re: A5W Page Filter and Order Syntax

    Unless you want to write CRUD routines to maintain a comma delimited column per Sales Rep... which is neither advisable... nor fun... then just follow a normal approach to your table...

    RecId RepId State
    1 1 SC
    2 1 NC

  23. #23
    Member
    Real Name
    Josh Cole
    Join Date
    Jun 2012
    Posts
    678

    Default Re: A5W Page Filter and Order Syntax

    Carl,

    What type of back-end database are you working with? What I usually do in these instances is create a table in my database to map a sales rep to each state he/she needs to be associated with. I would then create a view that returns the appropriate records. Once that is in place everything will work as expected. If you can share what type of database you're working with I can help you see this to fruition.

  24. #24
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Josh, just a standard alpha database on this project. David, not sure I follow your table example above. Thanks.

  25. #25
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,244

    Default Re: A5W Page Filter and Order Syntax

    David that map is sweet, any chance you want to share that thing? I want the component to build a phone gap app to find some of my users...THAT would save me a bunch of time no doubt - nice job!
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

  26. #26
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Thanks for all the feedback thus far. Just wondering if anyone has any ideas on how to implement the idea mentioned above that a sales rep could possibly be assigned to multiple states, not just a single state.

  27. #27
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Any other feedback from anyone? I am so close to getting this to do what I need.

  28. #28
    Member
    Real Name
    Josh Cole
    Join Date
    Jun 2012
    Posts
    678

    Default Re: A5W Page Filter and Order Syntax

    Carl,

    The table data that you are basing your list control on needs to have a record of your sales agent for each state they are assigned to. I've never developed an application with a dbf back-end so I am unsure as to the best approach with dbf's.

    In the SQL world, one way to accomplish this would be to create two tables and a view. I would have a sales_rep table, a sales_rep_state_mapping table, and a sales_rep_state_view

    So my sales_rep table would look like...

    rep_ID
    rep_name
    rep_email
    rep_phone

    I'd create one record for John Smith who is a sales rep assigned to Tennessee and Alabama

    1|John Smith|john.smith@yourdomain.com|(555)555-5555


    I'd have a second table sales_rep_state_mapping
    recordID
    rep_id
    state

    I'd create two rows in sales_rep_state_mapping.

    1|1|AL
    2|1|TN

    Now I'd create a join marrying sales_rep and sales_rep_state_mapping, the link being rep_id. I'd make sure to return the rows from the sales_rep_state_mapping table. Once you've created the view, I'd base the list on the data that the view returns.

    I hope this makes sense. You could create multiple entries in a dbf table to accomplish the same thing but it would be pretty sloppy from a database design perspective. I don't think you can use dbf sets on the web side of Alpha which would be the equivalent of a view in the SQL world. If you can I'd make the change to a mysql or MS SQL express back-end. I'm sure there are many other options as well but DBF seems very limiting to me compared to your other free SQL options.
    Last edited by coleresources; 02-28-2016 at 04:48 PM.

  29. #29
    Member
    Real Name
    Carl B Smith
    Join Date
    Jun 2012
    Posts
    280

    Default Re: A5W Page Filter and Order Syntax

    Josh,

    I took your advice and have started migrating my database to SQL. It does seem to be more powerful, and creating views like you suggested is helpful.

    I've created a primary table that has the base sales info (name, phone, email, picture, etc), and joined that to my secondary table where I show the different state/regions that each person is in. I do like this scenario from the aspect that I don't have to load things like a sales reps picture each time. It does seem to be a more efficient way to do it.

    However, just wondering if there is still even a better way beyond this. Because, for example, if I have a sales rep that covers the east cost, there still has to be 20-30 entries for that one sales rep, one for each state in the secondary table. I think what I would love is if there was a way to set it up like checkboxes, so when I had a new rep, I can just hit a bunch of checks for the states they are in. But the key to that being that I need the check for each state to create a new row in my database. If my state/region field just has a bunch of states separated by commas, that doesn't work for my application unfortunately. I need to have separate rows for each state.

    Anybody have any additional thoughts on this? Thanks!

Similar Threads

  1. Query Order Syntax Question
    By johngtatp in forum Alpha Five Version 11 - Desktop Applications
    Replies: 4
    Last Post: 03-17-2012, 06:01 AM
  2. Tree Node Filter/Link/Order: Order takes me to Filter????
    By MarionT in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 02-02-2012, 07:50 PM
  3. DBF.filter syntax
    By vinyltap in forum Application Server Version 10 - Web/Browser Applications
    Replies: 8
    Last Post: 05-07-2010, 10:43 AM
  4. Filter Syntax
    By crimmelcp in forum Alpha Five Version 5
    Replies: 1
    Last Post: 07-23-2004, 05:09 PM
  5. Filter syntax
    By Bill Harriff in forum Alpha Five Version 4
    Replies: 2
    Last Post: 06-16-2002, 06:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •