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

Extract xdialog variable

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

  • Extract xdialog variable

    The following code snippets yields a multi-select list box.

    auto_list_vProjects = set.external_record_content_get("set_wo_projects.set","Division+\"|\"+Project+\"|\"+Tbl_Projects->Locus_Name+\"|\"+Tbl_Projects->Client","Tbl_Projects->Office+Status+invert(Project)","Status
    vChoice2 = ui_dlg_box("Create Billing Sheets:",
    {region}
    Select one or more Projects:|
    {endregion};
    {region}
    [%M;d;O={@@}%.90,25vProjects^#a_vProjects];
    {endregion};
    {line=1,0};
    {region}

    {endregion};
    %dlg%)

    trace.WriteLn(vProjects)


    I need to extract the selected choices. But I get the following result in the trace window from the vProjects variable.

    C:\Program Files\A5v5\Shadow\Dba5\Set_Clientinvoice.set
    {F=Arial,8}{C=Black,White}{B=White,Dark Blue}G{T=0.15}3783.00{T=0.7}127 Mickey Mouse Drive {T=2.5}Huyen, Spike
    {F=Arial,8}{C=Black,White}{B=Green White,Dark Blue}B{T=0.15}3781.00{T=0.7}9 Main Street {T=2.5}Horn, Charles
    {F=Arial,8}{C=Black,White}{B=White,Dark Blue}B{T=0.15}3780.00{T=0.7}77 Willis St., Charlston {T=2.5}Acme Realty Corp.

    How do I extract the variable results w/o all the crap?

    Peter
    Peter
    AlphaBase Solutions, LLC

    Peter@AlphaBaseSolutions.com
    https://www.alphabasesolutions.com



  • #2
    RE: Extract xdialog variable

    To repeat, there are three lines of pertinent code:

    auto_list_vProjects = set.external_record_content_get("set_wo_projects.set","Division+\"|\"+Project+\"|\"+Tbl_Projects->Locus_Name+\"|\"+Tbl_Projects->Client","Tbl_Projects->Office+Status+invert(Project)","Status

    auto_list_vProjects = a5_owner_draw_list_fmt(auto_list_vProjects,vFormat)

    [%M;d;O={@@}%.90,25vProjects^#a_vProjects]

    So I need the slected choices w/o the formatting codes. Seems like there must be a reverse function for the a5_owner_draw_list_fmt function, or something?

    There must be a simple way to do this?

    PG
    Peter
    AlphaBase Solutions, LLC

    Peter@AlphaBaseSolutions.com
    https://www.alphabasesolutions.com


    Comment


    • #3
      RE: Extract xdialog variable

      Peter

      You can parse out the values yusing substr() and the at() function. For example from the first line, you can get this in the interactive window

      text = "{F=Arial,8}{C=Black,White}{B=White,Dark Blue}G{T=0.15}3783.00{T=0.7}127 Mickey Mouse Drive {T=2.5}Huyen, Spike "
      addr1 = substr(text,at("}",text,5)+1)
      addr1 = substr(addr1,1,at("{",addr1)-1)

      ?addr1
      = "127 Mickey Mouse Drive "

      you can combine the two expressions and get this

      addr1 = substr(substr(text,at("}",text,5)+1),1,at("{",substr(text,at("}",text,5)+1))-1)
      ?addr1
      = "127 Mickey Mouse Drive "

      You can create expressions for each element. The initial expression takes a little work, but once you have it, you can get any data you need.

      Jerry

      Comment


      • #4
        RE: Extract xdialog variable

        Jerry thanks,

        So ya' gotta do it da hard way, huh? Geeze!

        I can't believe the brilliant architects of Alpha have left us to our own devices. Damn!

        Peter
        Peter
        AlphaBase Solutions, LLC

        Peter@AlphaBaseSolutions.com
        https://www.alphabasesolutions.com


        Comment


        • #5
          RE: Extract xdialog variable

          Peter

          That is a common issue using any embedded owner draw controls. Since the owner draw controls can take many forms, each solution must be unique, but all involve parsing out the relevant data.

          Jerry

          Comment


          • #6
            RE: Extract xdialog variable

            Live & learn.
            Peter
            AlphaBase Solutions, LLC

            Peter@AlphaBaseSolutions.com
            https://www.alphabasesolutions.com


            Comment


            • #7
              RE: Extract xdialog variable

              Actually, there's a pretty easy way to do it.
              1) make the vProjects variable a numeric variable by setting
              dim vProjects as n
              or
              vProjects=0
              before calling the ui_dlg_box(). Then vProjects is the number of the selection.
              2) use word(auto_list_Projects,vProjects,crlf())
              to get the actual choice without the formatting.

              It's really pretty simple.

              Comment


              • #8
                RE: Extract xdialog variable

                Oops. I realize that you have a multi-select list box. I don't know if that technique will work with a multiselect box -- it will work with a single choice but I don't know if you can use numeric variables with a multiselect box. Try it and let us know.

                Comment


                • #9
                  RE: Extract xdialog variable

                  Peter

                  This is a technique I use with regular list boxes. If I need to use owner draw controls, I create a dot variable. For each array value I have multiple properties. One might be .display, which contains the owner draw values and the text to display and then another might be .return, which contains the return value. As you suggest, I then use a number pointer for the return value. I take that and and get the relevant array entry to find the return value. Much easier than parsing the data. Here is a section of an example using the other Peter's code

                  dim vProjects as n
                  dim a_v_projects[200] as p

                  a_v_projects[1].display =
                  "{F=Arial,8}{C=Black,White}{B=White,Dark Blue}G{T=0.15}3783.00{T=0.7}127 Mickey Mouse Drive {T=2.5}Huyen, Spike"

                  a_v_projects[1].addr1 = "Mickey Mouse Drive"
                  a_v_projects[1].value = "3783.00"

                  ' Now the line in xdialog
                  [%M;d;O={@@}%.90,25vProjects^#a_vProjects[/].display];

                  To find the value needed, go to the array

                  addr1 = a_v_projects[vProjects].addr1
                  value = a_v_projects[vProjects].value

                  I haven't tried it either with multiselect list boxes, but an experiment should be interesting.

                  Jerry

                  Comment


                  • #10
                    RE: Extract xdialog variable

                    Peter,

                    If I Dim vProjects as N, vProjects is returned as 0, regardless of selection choice.

                    If I:

                    trace.WriteLn(word(auto_list_vProjects,1,crlf()))
                    trace.WriteLn(word(auto_list_vProjects,2,crlf()))
                    trace.WriteLn(word(auto_list_vProjects,3,crlf()))

                    I get the first three items in the list (regardless of my selection) WITH the formatting strings.

                    Peter
                    Peter
                    AlphaBase Solutions, LLC

                    Peter@AlphaBaseSolutions.com
                    https://www.alphabasesolutions.com


                    Comment


                    • #11
                      RE: Extract xdialog variable

                      Jerry,

                      I'm not sure I follow you. How do I assign the array data values w/o first pasing the data? In your example you do it manually. What am I missing?

                      Peter
                      Peter
                      AlphaBase Solutions, LLC

                      Peter@AlphaBaseSolutions.com
                      https://www.alphabasesolutions.com


                      Comment


                      • #12
                        RE: Extract xdialog variable

                        Jerry, using your example I wrote the following simple function and then looped thru the records as shown:

                        Function funcParseXdialog as C (vInput as C, vPos as N)
                        funcParseXdialog = substr(substr(vInput,at("}",vInput,vPos)+1),1,at("{",substr(vInput,at("}",vInput,vPos)+1))-1)
                        End Function

                        vNoProjects = w_count(vProjects,crlf())
                        For i = 1 to vNoProjects
                        vProjectString = word(vProjects,i,crlf())
                        vDiv = funcParseXdialog(vProjectString,3)
                        vProjNo = funcParseXdialog(vProjectString,4)
                        vAddress = funcParseXdialog(vProjectString,5)
                        vName = funcParseXdialog(vProjectString,6)
                        vList = vList + vDiv+"-"+vProjNo+" "+TRIM(vAddress)+" "+TRIM(vName) + crlf()
                        next

                        Thanks again,
                        Peter
                        Peter
                        AlphaBase Solutions, LLC

                        Peter@AlphaBaseSolutions.com
                        https://www.alphabasesolutions.com


                        Comment

                        Working...
                        X