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

Progressive Lookup Function

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

  • Tom Cone Jr
    replied
    Re: Progressive Lookup Function

    D,

    The cancel button is not handled explicitly. The default behavior of the xdialog stores "Cancel" in a_dlg_button and closes the xdialog. The following section of code assigns the character string "-1" to the return value from the function (not the dialog) since vDlgReturn will not equal "OK".

    Code:
    select
       case vDlgReturn <> "OK"
       	  ProgressiveLkUp = -1
       case vRecNumber > 0
       	  ProgressiveLkUp = vRecNumber
       case else
       	  ProgressiveLkUp = -1
    end select
    If you get a "-1" character string return from the function it means that either the user pressed Cancel button or (having first selected a row) the user has pressed the Esc key.

    Read the help file discussion of Xdialog events for details on the default behavior. You will find that pushing any button will assign the name of that button to a_dlg_button. Since a_dlg_button is not empty the dialog will close unless you trap the event in code and assign null to a_dlg_button to keep the xdialog open.

    Leave a comment:


  • dik_coleman
    replied
    Re: Progressive Lookup Function

    ooops here I go again ---

    It may only be me, but would someone look at the latest 'hot' version of this lookup and tell me where <Cancel> is handled on the initial lookup screen.
    Not the form that may be used to display the data, the actual dialog box that contains the names, etc.....

    I can't find it anywhere...... I would like to be able to completely cancel the entire operation from that <Cancel> button, close the display form and go back to the 'whatever' that called the lookup.

    Any help is appreciated.
    D

    Leave a comment:


  • Al Buchholz
    replied
    Re: Progressive Lookup Function

    Originally posted by dik_coleman View Post
    The problem occurred whenever I would hold the down arrow (for the table, not the visible data in the box) and go past EOF on these small tables.
    Like my doctor told me - don't do that... :p

    Originally posted by dik_coleman View Post
    Also, the last record lookup data would sometimes repeat if the table data did not completely fill the dialog box.
    Can you send me your tables and code so I can look at it?
    I can send you a link to upload or you can email it directly.

    Originally posted by dik_coleman View Post
    thanx for your response and hope to see you again at the next conference.

    D
    God willing and a fair wind, we'll be at the conference again.
    It was good to see you at this year's conference and hopefully I'll see you and many others at the next one...

    Leave a comment:


  • dik_coleman
    replied
    Re: Progressive Lookup Function

    Al,
    I am using the latest revision of the prog lkup, with your last mod.
    I cannot duplicate the problem. It appeared ONLY in 4 very small lookup tables containing numeric data only. The problem occurred whenever I would hold the down arrow (for the table, not the visible data in the box) and go past EOF on these small tables. Also, the last record lookup data would sometimes repeat if the table data did not completely fill the dialog box.
    Using larger tables seems to 'overcome' the problem. The dialog box will still go 'blank' when passing EOF using the outside down arrow; but pressing the outside up arrow will bring back correct 'active' data.
    Not sure there is a problem, and not sure I like the second scroll bar (YET).

    thanx for your response and hope to see you again at the next conference.

    D

    Leave a comment:


  • Al Buchholz
    replied
    Re: Progressive Lookup Function

    D

    I see that but haven't had the freeze.

    Do you have the mod that I added?

    Also, what I see in those 2 scroll bars is an interesting situation. Given the way this function works, the inside scroll bar scrolls through records already retrieved and the outer scroll bar scrolls through the entire table.

    I can see where not having the mod that I added might cause a 'freeze' - or slow response in a larger table.

    With what mod did you see this double scroll bar appear?

    Thanks for sharing...

    Leave a comment:


  • dik_coleman
    replied
    Re: Progressive Lookup Function

    Has anyone noticed that the latest mods to the Prog Lkup now give a display box with two (2) vertical scroll bars and when scrolling with the most right hand one, you can freeze up the display box????

    I have no idea how to fix it or I would and then post it...

    D

    Leave a comment:


  • Al Buchholz
    replied
    Re: Progressive Lookup Function

    Originally posted by Alan Lucas View Post

    The full code is now in the attached text file.

    Alan
    Here is a correction to the correction to keep this function as fast as possible...

    Since the variable i wasn't being changed with by the increment_value() function, the entire table was being scanned. Not a problem with a small number of records, but on larger numbers of records it's crippling.

    Code:
         i = 1
        while i <= vCount .and. .not. vTable.fetch_eof()
            vKey = vIndex.key_get()
            BuildList = BuildList + "{data="+padl(alltrim(str(vKey.record)),10,"0")+"}"+ vKey.key + crlf() 
            vTable.fetch_next()       
    '        increment_value(i)  ' old code   
            [B][COLOR=Red]i=increment_value(i) ' change of old code[/COLOR][/B]
        end while

    Leave a comment:


  • kthibeault1965
    replied
    Re: Progressive Lookup Function

    Jim

    I have studied your progressive lookup threads, and feel your approach could give me some answers in a very tricky problem i posted yesterday.

    Basically I have to search for the occurrence of hundreds of key words, within a memo field.

    I documented my approach and problem here, and would be in great debt to you for any suggestions and or ideas that could help.

    cheers
    keven

    http://msgboard.alphasoftware.com/al...ad.php?t=69365

    Leave a comment:


  • Alan Lucas
    replied
    Re: Progressive Lookup Function

    It appears that some of the code in my previous message was cut off?

    The full code is now in the attached text file.

    Alan

    Leave a comment:


  • Alan Lucas
    replied
    Re: Progressive Lookup Function

    Had a problem with the build list in the progressive look up it was not displaying the last item in the list. Tom Cone finally solved the issue by commenting out part of BuildList section of the code. The full code function is included below.

    Thank you Tom.

    Alan


    [CODE]
    'Date Created: 22-Sep-2005 08:51:46 PM
    'Last Updated: 02-Aug-2007 04:27:49 PM
    'Created By : Jim Chapman
    'Updated By : Tom
    FUNCTION ProgressiveLkUp AS N (vTableName AS C, vIndexName AS C, vNumberOfLines AS N, vWidth AS N )

    dim shared pos as n 'The position of the scroll bar
    dim shared vList as c 'The list variable that is displayed in the control
    dim shared vSelect as c 'The 'record' selected by the user
    dim shared vTypeIn as c 'The variable that contains the 'search for' string the user types in

    pos = 0
    vSelect = ""
    vTypeIn = ""
    t = table.open(vTableName,FILE_RO_SHARED)
    vIndex = t.index_primary_put(vIndexName)
    t.fetch_first()
    vFirstRecordNumber = t.recno()

    vList = ""
    vList = BuildList(t,vIndex,vNumberOfLines)
    dim shared vpgdn as n

    vDlg =vWidth],[varN->vNumberOfLines]vSelect^#vList!vList_*]{vscroll=%0,[varN->vNumberOfLines+1]%3,[varN->vNumberOfLines]pos!pos_Changed};

    %dlg%

    vDlg = replace_parameters(vDlg,local_variables())


    vDlgReturn = ui_dlg_box("Look Up",vDlg, line_count(vList)
    GetCurrentValues("PageDown",line_count(vList))
    else
    GetCurrentValues("PageDown",vNumberOfLines)
    end if
    case else
    vList = BuildList(t,vIndex,vNumberOfLines)
    GetCurrentValues("PageDown",1)
    end select
    end if

    if a_dlg_button = "pgup"
    a_dlg_button = ""
    select
    case pos > 1
    GetCurrentValues("PageUp",1)
    case else
    for i = 1 to (vNumberOfLines + line_count(vList))
    if t.bof(vIndexName)
    exit for
    end if
    t.fetch_prev()
    next
    vList = BuildList(t,vIndex,vNumberOfLines)
    GetCurrentValues("PageUp",1)
    end select
    end if

    if a_dlg_button = "vList_Change"
    a_dlg_button = ""
    vCurrentLine = word_number_get(vList,vSelect,crlf())
    vReturnString = GetCurrentValues("vList_Changed",vCurrentLine)
    end if
    if left(a_dlg_button,6) = "vList_"
    a_dlg_button = ""
    end if
    %code%)
    t.close()
    vRecNumber = val(vSelect)
    select
    case vDlgReturn "OK"
    ProgressiveLkUp = -1
    case vRecNumber > 0
    ProgressiveLkUp = vRecNumber
    case else
    ProgressiveLkUp = -1
    end select

    END FUNCTION


    function GetCurrentValues as C (vWhatFired as c,vPositionNum as n)
    vCurrentString = word(vList,vPositionNum,crlf())
    '*****************************************************************************
    '*** Uncommenting the following lines will cause the type in control to reflect
    '*** highlighted selection when using page and arrow keys, mouse and scroll bar
    '*****************************************************************************
    'if vWhatFired "TypeInChanged"
    ' vTypeIn = alltrim(substr(vCurrentString,at("}",vCurrentString)+1))
    'end if
    vTempLen = at("}",vCurrentString) - 7
    vSelect = substr(vCurrentString,7,vTempLen)
    pos = vPositionNum
    GetCurrentValues = "T"
    end function

    function BuildList as c (vTable as p,vIndex as p,vCount as n)
    BuildList = ""
    ' for i = 1 to vCount
    ' vKey = vIndex.key_get()
    ' BuildList = BuildList + "{data="+padl(alltrim(str(vKey.record)),10,"0")+"}"+ vKey.key + crlf()
    ' vTable.fetch_next()
    ' if vTable.eof(vIndex.name_get())
    ' exit for

    Leave a comment:


  • dik_coleman
    replied
    Re: Progressive Lookup Function

    I have put the 'new' progressive lookup into several apps and am beginning to find some anomolies.....

    Mind you, these may be of my own doing and not a problem with the function.

    Using the old 'Record List - List Box' method, the last name typed would remain at the top of the search box whenever a new record was initiated -- even if I had to leave the data entry form and create a new customer record so that I could enter the sales transaction (known hereafter as tx).

    Maybe a little 'splanation' will help.
    Entering sales txs, the new record button does a search for name using the function --- customer not in table.
    Now the entire or partial name that was typed in for the search is still present in the entry area when I cancel the sales tx (ergo cancel the new record entry). Then press a button on the tx form to go to the 'new customer - modal form'. After completing new cus entry, return to tx form and press 'new record'.... the name is still in the entry area and the lookup has gone to the new customer record.....

    with the new function, the entry area has been cleared... probably rightly so..

    It's not a problem and the lookup works just fine -- just have to retype some data.

    The other 'anomoly' is that after several entries, I seem to be losing the ability to use the up and down arrows to move the cursor.... Cursor movement was a really great improvement in the new function....

    Noticed something in the AlphaSports Explained chm when looking at some of the functions for the 'property sheet'. Apparently Selwyn feels that a closing statement for the main function (when internal functions are present) has got to be specific to the main function..

    At least that's what it looks like to me.... The function definition includes :
    ( 1) and the main function close is : end function ( 1)------------------

    My mind is not at Selwyn's level so I really have no idea what it means, it just looks like a close specific to the main function

    My only concern is the loss of the cursor movement using the keyboard, but the world will continue with or without it.

    D

    Leave a comment:


  • Alan Lucas
    replied
    Re: Progressive Lookup Function

    Thanks Ken,

    Good sound advice, I will play with it and conquer.

    Alan

    Leave a comment:


  • forskare
    replied
    Re: Progressive Lookup Function

    Yes, the "v" usually indicates a variable. Open alphaSports and make note of the table and fields that contain the basic info such as the customer name, etc. Study the code and identify the variables; write down the names. compare the names of the fields and the 'Customer' table to the code.

    Next, change the variable names, the table name and field names to reflect your table name, etc. If you don't want, a particular field, delete the code to which it refers. If you want to add a field, simply add the code by copying the part of the code dealing with the field and change the names.

    I believe you will also need to create an index for each search field. I may have missed something but jump in and paly with it. That is the best way to learn.

    kenn

    Leave a comment:


  • Jim Chapman
    replied
    Re: Progressive Lookup Function

    Hello Don,

    I was wondering if there was any way of changing them 'on the fly'
    There are several ways to achieve this. For instance, if you put a row of buttons that corresponded to the different searches you'd like to accomplish, lets say: <Last Name> <Company Name> <State>
    When the user presses a button, you'd change the value held in the vIndex variable to the desired index, blank out the 'search for' control, and re-build the list based on the new index.

    Another way to accomplish this would be to use a modeless Xdialog display. One of the great things about Xdialog is that the construct of the display is simply a text string passed into the function ( ui_dlg_box() and ui_modeless_dlg_box() ). By using the same name for a modeless Xdialog display you can dynamically change the Xdialog on the fly.

    This is a simple example but once you grasp this, then changing the field (index) for the progressive lookup is done by calling the same modeless xDialog box with different parameters.

    Code:
    vdlg = <<%dlg%
    This is Text one;
    The first display;
    {line=1};
    <Switch> <Close>
    %dlg%
    
    vdlg2 = <<%dlg%
    This is Text two;
    The second display;
    {line=1};
    <Switch> <Close>
    %dlg%
    
    vCode = <<%code%
    if a_dlg_button = "Switch"
    	a_dlg_button = ""
    	if WhichVersion = "First"
    		WhichVersion = "Second"
    		ui_modeless_dlg_box("Test",vdlg2,vCode)
    		else
    		WhichVersion = "First"
    		ui_modeless_dlg_box("Test",vdlg,vCode)
    	end if
    end if 
    if a_dlg_button = "Close"
    	ui_modeless_dlg_close("Test")
    end if 
    %code%
    
    dim WhichVersion as c
    WhichVersion = "First"
    
    ui_modeless_dlg_box("Test",vdlg,vCode)
    If you don't want to use the first two approaches you could also achieve the same effect by programically closing one modal Xdialog box and instantly open another 'identical' one with the different parameters. There would probably be a slight screen flicker as the next list was build, but it should be acceptable.

    Good luck,
    Jim

    Leave a comment:


  • Don Bartlett
    replied
    Re: Progressive Lookup Function

    Thank you Kenn, Alan and Tim for your suggestions.
    I understand the concept of changing the arguments passed to the function 'hard coded' within a script so to speak. I was wondering if there was any way of changing them 'on the fly' ie:once the lookup was already open.
    My apologies for not making my question more specific; your replies
    have been very helpful, I'm going to rethink my approach to the problem.

    Don

    Leave a comment:

Working...
X