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

ProgressiveFind Help needed

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

    ProgressiveFind Help needed

    If you type ProgressiveFind into the help files you get nothing on this.

    I made a copy of the ProgressiveFind script and called it ProgressiveFindtwo

    This is from the Alpha sports V8 customer form.

    I placed the button over onto another form i want to use the ProgressiveFind on but i have no clue how to set up the ProgressiveFind script to work for this form and a table called eventvendors.

    I looked for a action script hoping that the ProgressiveFind can be added to any button using action script asking what form and everything to set up a new ProgressiveFind just for this form but i did not see one.

    Here is the current ProgressiveFind

    How can i change this to work with the eventvendors table? In place of the customer table. all i need it to search for is A field called COMPNAME

    Thanks

    -----------------------------------------
    'Date Created: 07-Jul-2005 09:28:14 AM
    'Last Updated: 26-Nov-2006 12:29:42 PM
    'Created By : Aaron
    'Updated By : Selwyn

    'This script is called from the 'Find Customer' button on the
    'Customer Information form.
    dim flagCloseAfterFind as l

    dim p as p
    p.closeAfterFind = .f.
    a5_load_settings("ProgressiveFind",p)
    flagCloseAfterFind = p.closeAfterFind


    DIM vLastname as C = ""

    DIM vCustomerID AS C
    DIM CurrentSortField AS C = "Lastname"
    DIM CurrentSortDirection AS C = "A"
    DIM Filter AS C
    DIM pTableDef AS P
    DIM pTableDef.ReturnValueExpression AS C = "Customer_id"
    DIM pTableDef.FieldList AS C = <<%txt%
    Firstname
    Lastname
    Company
    %txt%

    DIM pTableDef.TitleRow AS C = "{WIDTH=1.65}Firstname|{WIDTH=1.65}Lastname|{WIDTH=1.7}Company"
    DIM pTableDef.Arguments AS C = <<%txt%
    <arrArgs<[1]<Name="argLastname">
    <DataType="Character">
    <Source="vLastname">
    <SourceType="Local Variable">
    <DefaultValue="">
    <Prompt=.F.>
    <PromptText="">
    <PromptControlType="Text Box">
    <PromptChoices="">
    <PromptDlgTitle="Missing Argument">
    <PromptTextAbove="">
    >
    >
    <lastbutton="ok">
    %txt%

    DIM pTableDef.pArgs AS P
    property_from_string(pTableDef.pArgs, pTableDef.Arguments)
    DIM pTableDef.TableName AS C = "customer"
    DIM pTableDef.Filter AS C = "iif(current(len(:argLastname))=0,.t., left(lastname, current(len(:argLastname)))= :argLastname)"
    DIM pTableDef.Order AS C = "Lastname"
    DIM t AS P
    dim rr as alpha5::RowRelation
    dim rs as p


    pLV.titlerow = pTableDef.titlerow
    pLV.titleevents = "Sort_Firstname|Sort_Lastname|Sort_Company"
    pLV.style = "report,singlesel,showselalways,fullrowselect"
    pLV.dragbehaviour = ""
    pLV.dropbehaviour = ""

    IF .NOT. file.exists(table.filename_get(pTableDef.TableName))
    END
    END IF

    t = table.open(pTableDef.TableName, FILE_RO_SHARED)
    t.persist()

    rs = rr.TableToRowSource(t)

    Filter = GetArguments(pTableDef, local_variables())
    pLV.rowview = rs.OpenView(1,pTableDef.Order,Filter)
    pLV.RowSeparator = crlf()
    pLV.ColumnSeparator = "|"
    pLV.Columns = pTableDef.FieldList
    pLV.Key = pTableDef.ReturnValueExpression

    pLV.events = <<%code%
    function OnRightClick as c(lv as p,listView as p,args as p)
    WITH lv
    listView.Selection = listView.GetRowValue(args.GetClickRow())
    OnSelectionChanged(lv, listView )

    'to call a function outside the events code, you must use the ui_dlg_eval() function
    'menu = ui_dlg_eval(dlg_title,"a5wcb_PublishRclick(selectedFilename)")

    ' ui_msg_box("OnRightClick",listview.selection)
    END WITH
    end function

    function OnDoubleClick as c(lv as p,listView as p,args as p)
    WITH lv
    vCustomerID = listView.GetRowValue(args.GetClickRow())
    ' ui_msg_box("OnDoubleClick",vCustomerID)
    t = topparent.table_get()
    dim recno_for_custid as n
    'The event handler for the ListView cannot see the local functions in the script.
    'The ui_dlg_eval() function evaluates a function in the context of the named UI_DLG_BOX().
    'Since the Xdialog referenced by 'dlg_title' CAN see the local FindRecNoForCustomerID() function,
    'we are able to evaulate the expression and get the record number for the selected CustomerId.
    recno_for_custid = ui_dlg_eval(dlg_title,"FindRecNoForCustomerID(vCustomerID)")
    t.fetch_goto(recno_for_custid)
    topparent.resynch()
    if flagCloseAfterFind then
    ui_dlg_event(dlg_title,"Close")
    end if

    END WITH
    end function

    FUNCTION OnSelectionChanged AS V (lv AS P, listView as p )
    WITH lv
    vCustomerID = listView.Selection
    END WITH
    END FUNCTION

    FUNCTION OnKeyDown as v(vars as p,listView as p,args as p)
    DIM key AS C
    Dim KeyName as c

    key = args.GetKeyName()
    KeyName = key

    IF key = "{Delete}" .OR. key = "{Num Del}"
    KeyName = "{Delete}"
    ELSE IF args.keycode = 13 ' enter
    KeyName = "{Enter}"
    ELSE IF args.keycode = 8 ' backspace
    KeyName = "{Backspace}"
    END IF

    'ui_msg_box("OnKeyDown", KeyName)
    END FUNCTION
    %code%

    IF is_object(topparent.this)
    dlg_title = topparent.name(16)+"@:Find Customer: Progressive Lookup"
    ELSE
    dlg_title = "Find Customer: Progessive Lookup"
    END IF


    ui_modeless_dlg_box(dlg_title,<<%dlg%
    {watch=vLastname!refresh}
    {auto_external_refresh}
    {can_exit=close}
    {wrap=100}
    To find a customer, begin typing the customer's last name into the 'Enter last name' textbox below. As you type the last name, the list will change to show the closest matches. For example, typing 'Ba' will bring up John Baker and Tom Barber.;
    {lf};
    {region}
    {region}

    Enter last name:| [.40vLastname];
    {endregion};
    {lf};

    Select Customer:;
    {listviewvirtual=100,15vCustomerID^=pLV};;
    {endregion};
    {endregion};;;
    {line=1,0};
    {region}
    <*15Goto Record!goto_record?vCustomerID<\>""> <15&Close!close> {sp=10}(flagCloseAfterFind!closeSettingChanged) Automatically close after find;
    {endregion};
    %dlg%,<<%code%
    IF left(a_dlg_button, 5) = "Sort_"
    DIM NewSortField AS C
    NewSortField = substr(a_dlg_button, 6)
    DoSort(CurrentSortField, CurrentSortDirection, NewSortField, Filter, pLV, rs)
    a_dlg_button = ""
    END IF

    if a_dlg_button = "closeSettingChanged" then
    a_dlg_button = ""
    p.closeAfterFind = flagCloseAfterFind
    a5_save_settings("ProgressiveFind",p)
    end if

    IF a_Dlg_button = "refresh"
    a_dlg_button = ""

    Filter = GetArguments(pTableDef, local_variables())
    pLV.RowView.Close()
    pLV.RowView = rs.OpenView(1, CurrentSortField, Filter)

    END IF

    IF a_Dlg_button = "goto_record"
    a_dlg_button = ""
    t = topparent.table_get()
    t.fetch_goto(FindRecNoForCustomerID(vCustomerID))
    topparent.resynch()
    if flagCloseAfterFind then
    ui_modeless_dlg_close(dlg_title)
    end if
    END IF

    IF a_dlg_Button = "Close"
    ui_modeless_dlg_close(dlg_title)
    END IF
    %code%)


    FUNCTION FindRecNoForCustomerID AS N ( vCustomerID AS C )
    DIM t AS P
    DIM nResult AS N

    t = table.open("customer", FILE_RO_SHARED)
    t.order("Customer_ID")
    nResult = t.fetch_find(vCustomerID)
    t.close()

    FindRecNoForCustomerID = nResult
    END FUNCTION


    FUNCTION DoSort AS V (byref CurrentSortField AS C , byref CurrentSortDirection AS C, NewSortField AS C, Filter AS C, pLV AS P, rs AS P )
    DIM cResult AS C
    DIM SortDirection AS C
    DIM SortField AS C

    IF NewSortField = CurrentSortField
    ' clicked on same field, reverse sort
    IF CurrentSortDirection = "D"
    CurrentSortDirection = "A"
    ELSE
    CurrentSortDirection = "D"
    END IF
    ELSE
    CurrentSortField = NewSortField
    CurrentSortDirection = "A"
    END IF

    SortDirection = CurrentSortDirection
    SortField = CurrentSortField
    IF SortDirection = "D"
    SortField = "invert(" + SortField + ")"
    END IF

    ' actual sorting code goes here
    pLV.RowView.Close()
    pLV.RowView = rs.OpenView(1, SortField, Filter)

    DoSort = cResult
    END FUNCTION




    FUNCTION GetArguments AS C ( pTableDef AS P, lv AS P )
    DIM cResult AS C

    FOR EACH x IN pTableDef.pArgs.arrArgs
    IF (":"+x.Name) $ pTableDef.Filter
    x.value = GetValue(x, lv)
    END IF
    NEXT

    cResult = a5_ArgumentsReplace(pTableDef.filter, pTableDef.pArgs.arrArgs)

    GetArguments = cResult
    END FUNCTION



    FUNCTION GetValue AS A ( pArg AS P , lv AS P)
    DIM aResult AS A
    DIM var AS C

    var = pArg.Source

    IF eval_valid("lv." + var)
    aResult = eval("lv."+var)
    ELSE IF eval_valid(var)
    aResult = eval(var)
    ELSE
    DIM pArgDlg AS P
    IF pArg.Prompt .AND. pArg.DefaultValue = ""
    pArgDlg = a5_ArgPromptDialog(pArg)
    IF pArgDlg.lastbutton = "cancel"
    EXIT FUNCTION
    END IF
    aResult = pArgDlg.value
    ELSE
    aResult = convert_type(pArg.DefaultValue, left(pArg.DataType,1))
    END IF
    END IF

    GetValue = aResult
    END FUNCTION
    ------------------------------------------------------------

    #2
    Re: ProgressiveFind Help needed

    It would be nice if you format the code with the #-code tags.
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

    Comment


      #3
      Re: ProgressiveFind Help needed

      Ed,

      You can do the progressive lookup with action scripting. Choose xdialog type of action scripting and then "List View Control". There is a full explanation of how to do it here:

      http://support.alphasoftware.com/Alp...ive_Lookup.htm

      Regards,

      Jeff

      Comment


        #4
        Re: ProgressiveFind Help needed

        Thanks Jeff just what i needed..

        Comment

        Working...
        X