Alpha Video Training
Results 1 to 11 of 11

Thread: Un-order list in dialog box?

  1. #1
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Un-order list in dialog box?

    Hi Guys,

    I have the following code in a dialog box. It is simply to display the four seasons in order of occurrence as they are in the table. eg Spring, Summer, Autumn and Winter.

    When the dialog is run the list gets sorted into alphabetical order, what do I need to change to display the list in the same order as it is in the table?
    Code:
    'Create an XDialog dialog box to prompt for parameters.
    DIM SHARED vc_seasons as C
    DIM SHARED varC_result as C
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    DIM vc_seasons_rl_def as C 
    vc_seasons_rl_def = "kl=season_test,{keylist_build(\"H=.05,1:25[Season]\",''+season,left(''+season,25))}{}"
    varC_result = ui_dlg_box("Seasons1",<<%dlg%
    {region}
    Type prompt here:| [%@vc_seasons_rl_def%.40,5vc_seasons];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%)
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  2. #2
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,875

    Default Re: Un-order list in dialog box?

    Keith,
    You specified season as the key. therefore, "Autumn", "Spring", "Summer", then "Winter" is correct in ascending order. Is there an indicator of which month you are speaking of? if so, then you could use that as the order. If not, you may need to add some sort of flag field to the season_test table, ie: Spring=1, Summer=2, Autumn=3, Winter= 4, then use that as the key, but display the "Season"field.

    Tom

  3. #3
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Un-order list in dialog box?

    Thanks Tom.

    I shall add a record Id field and see if that does the job.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  4. #4
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Un-order list in dialog box?

    Tom,

    Tried your suggestion. It only works if you want to display the key field too.

    I would like to display the records in the order they are in the table, that is without sorting.

    Your help as always is appreciated.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Un-order list in dialog box?

    It only works if you want to display the key field too.
    Don't you control the width of the display?
    There can be only one.

  6. #6
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,875

    Default Re: Un-order list in dialog box?

    Keith,
    it sounds like you are only trying to display the 4 seasons. If so, why not just use a list box and define them yourself.

    I used the genie and this is the code generated.

    Code:
    DIM SHARED season as C
    DIM SHARED varC_result as C
    DELETE a_season		
    DIM a_season[4] as c
    dim temp_list as c 
    temp_list = <<%list%
    Spring
    Summer
    Autumn
    Winter
    %list%
    
    a_season.initialize(temp_list)
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Alpha Five",<<%dlg%
    {region}
    Type prompt here:| [.40,5season^#a_season];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%)
    I created a table of seasons, and when I built the dialog, I chose record number order and it gives me the appropriate order as I entered them.

    Code:
    'Create an XDialog dialog box to prompt for parameters.
    DIM SHARED Selected_Season as C
    DIM SHARED varC_result as C
    auto_list_Selected_Season = table.external_record_content_get("seasons","Season","recno()","")
    
    temp_count = w_count(auto_list_Selected_Season,crlf())
    DELETE a_Selected_Season
    DIM a_Selected_Season[temp_count] as c
    a_Selected_Season.initialize(auto_list_Selected_Season)
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Alpha Five",<<%dlg%
    {region}
    Please Select your Season:| [.25,5Selected_Season^#a_Selected_Season];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%)
    Tom
    Last edited by Tom Henkel; 10-22-2013 at 05:25 PM. Reason: 2nd option

  7. #7
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,201

    Default Re: Un-order list in dialog box?

    I also much prefer tercg() to populate the dialog and much less uneeded code. More control. Recno is default order.

    Code:
    ' get table list
    	dim vLseasons as C
    	vLseasons=table.external_record_content_get("season_test","season")
    
    'Create an XDialog dialog box to prompt for parameters.
    	DIM SHARED vc_seasons as C
    	DIM SHARED vR as C
    	vR = ui_dlg_box("Seasons1",<<%dlg%
    	{region}
    	Season:| [.40,5vc_seasons^#vLseasons];
    	{endregion};
    	{line=1,0};
    	{region}
    	<*15OK> <15CANCEL>
    	{endregion};
    	%dlg%)
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  8. #8
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: Un-order list in dialog box?

    Thanks Guys,

    This new code has proved just the Job.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  9. #9
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Un-order list in dialog box?

    This is the closest example I could find for what I want to do - how to show the season list in this recno() order with a default value as the initial selection to show the user? For example with 'Autumn' selected.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  10. #10
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,084

    Default Re: Un-order list in dialog box?

    Robin,

    Did you mean this?

    Season_1.jpg

  11. #11
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Un-order list in dialog box?

    Yes! Thank you John. I was having some problems with a script and I think it was because of the order of things. I will try it now and see if that helps.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

Similar Threads

  1. List of next 10 days in Dialog Box with Check Box
    By Leah in forum Alpha Five Version 10 - Desktop Applications
    Replies: 13
    Last Post: 08-21-2012, 11:14 PM
  2. Sorting Order in a Record List-List Box
    By Alan Lucas in forum Alpha Five Version 7
    Replies: 7
    Last Post: 02-27-2006, 07:20 PM
  3. Order a record-list combo box
    By michaelklein in forum Alpha Five Version 5
    Replies: 8
    Last Post: 05-28-2004, 08:04 PM
  4. X-Dialog Refresh Record-List List-Box
    By Louis Nickerson in forum Alpha Five Version 5
    Replies: 7
    Last Post: 02-20-2003, 08:11 AM
  5. Dialog Box Record List Display Order
    By fairviewcomputing in forum Alpha Five Version 5
    Replies: 1
    Last Post: 10-18-2002, 08:31 AM

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
  •