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

xDialog Browse quandry

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

    xDialog Browse quandry

    I've created a browse of appointments for our clients. For ease of use (and just because I wanted to try something new) I created an x-Dialog of the browse. simple enough, go to browse properties, advanced, create x-Dialog with embedded browse.

    So far, so good.

    The x-dialog browse performs as expected and all are happy with it.

    The initial intent of the browse has changed now, we need to view either "in-person" or "Phone" appointments (Using field "Type") and I will need to change the filter.

    Once again, simple enough, go back to the initial browse, modify the filter for a new variable, and see if it works. If so, copy the browse filter definition to the saved x-dialog browse and we're good to go.

    Not Quite!

    While the browse itself works just great with the new filter, the x-dialog throws an error, and this is with the generated code!

    Code within "normal" browse:
    Code:
    A_Date =Var->appointment_date  .and. alltrim(Type)=Var->anst
    Original X-Dialog Browse definition code:
    Code:
    <browse width="1248" height="711" data_entry_style="modeless" restrict_enter="yes" restrict_change="yes" restrict_delete="yes" restrict_find="yes" restrict_range="yes" restrict_index="yes" restrict_query="yes" gridline_horizontal="yes" gridline_vertical="yes" restrict_column_resize="yes" restrict_column_move="yes" restrict_column_delete="yes" row_height="21"[COLOR="#FF0000"] filter="(a_date = Var-&gt;Appointment_Date  )  .and. ( alltrim(Type) &lt;&gt; &quot;Phone&quot; )"[/COLOR] order="toseconds(A_Time)+WORD(Name,2)">
    New X-Dialog code matching Browse Code:
    Code:
    <browse width="1248" height="711" data_entry_style="modeless" restrict_enter="yes" restrict_change="yes" restrict_delete="yes" restrict_find="yes" restrict_range="yes" restrict_index="yes" restrict_query="yes" gridline_horizontal="yes" gridline_vertical="yes" restrict_column_resize="yes" restrict_column_move="yes" restrict_column_delete="yes" row_height="21"[COLOR="#FF0000"] filter="(A_Date = Var-&gt;appointment_date ) .and. ( alltrim(Type)=Var-&gt;anst )" [/COLOR]order="toseconds(A_Time)+WORD(Name,2)">
    For some reason, I cannot upload the image of the error message, so I'll spell it out:

    Message box "Alpha Five"
    Exclamation symbol "Cannot use function in this context"
    "OK" Button

    Debugging it, all varibles are defined and
    Does anyone have any idea as to why the error would come up in an embedded x-dialog browse and not on the regular browse?

    Thanks,

    Tom

    Tom
    Attached Files
    Last edited by Tom Henkel; 06-18-2013, 06:47 PM. Reason: Highlight Filter differences

    #2
    Re: xDialog Browse quandry

    It appears the culprit is a test for a character expression in the filter. My guess is that the variable isn't quoted, so the filter is confused.

    Code:
    filter="(a_date = Var-&gt;Appointment_Date  )  .and. ( alltrim(Type) = [COLOR="#FF0000"]Var-&gt;ans_t [/COLOR])"
    a_date is defined as a date field, and so is the variable Appointment_Date. Type is a character field and so is variable ans_t.

    Quote and S_quote can't be used in HTML expressions, so my question is HOW DO I QUOTE THE VARIABLE???


    Tom

    Comment


      #3
      Re: xDialog Browse quandry

      Hi Tom,

      I never used HTML before so I don't know but maybe an expression like this: eval(s_quote(your code)) ?
      Ton
      Most things are simple but unfortunately only after the first time

      Comment


        #4
        Re: xDialog Browse quandry

        What was the original filter in xdlg that did work?

        Comment


          #5
          Re: xDialog Browse quandry

          Tom
          That method has been a game changer for me in some areas of my apps.
          I gave up trying to filter that way, in the Xdlg filter. What I do which also make it more universal;
          1. make the Xdlg a UDF if you havent already
          2. pass the table pointer as a parameter in the UDF (eg. ptr), and the field filter string (eg. fld)
          3. enter a new condition after init

          simple example:
          Code:
          if a_dlg_button <> "close" then 
          	ev=eval("ptr"+"."+fld)
          	browseObj1.QueryRun("code=" + quote(ev))
          	browseObj1.Fetch_Last() 'just where to "land"
          end if

          Comment


            #6
            Re: xDialog Browse quandry

            G,

            see my first post.

            Original X-Dialog Browse definition code:
            Code:

            <browse width="1248" height="711" data_entry_style="modeless" restrict_enter="yes" restrict_change="yes" restrict_delete="yes" restrict_find="yes" restrict_range="yes" restrict_index="yes" restrict_query="yes" gridline_horizontal="yes" gridline_vertical="yes" restrict_column_resize="yes" restrict_column_move="yes" restrict_column_delete="yes" row_height="21" filter="(a_date = Var-&gt;Appointment_Date ) .and. ( alltrim(Type) &lt;&gt; &quot;Phone&quot; )" order="toseconds(A_Time)+WORD(Name,2)">
            Ton,

            per the help, "s_quote() and quote() can't be used in xdialog html."

            It has something to do with them not being represented properly.

            Rom

            Comment


              #7
              Re: xDialog Browse quandry

              Tom,

              What is the scope of the anst or ans_t variable? I just set up a similar filter on a test browse in good ol' Alphasports and it works. I used global variables. Can you provide us with a bit more context or maybe even a sample.

              I was going to suggest browseObj1.QueryRun() as well but I use it directly in the INIT section of the xdialog code section.

              I try to use as few global variables as possible so I try to substitute the actual value in to any filters I need. In the case of a browse in xdialog where the definition is text in the form of xml I have used a method where I put a place holder in the filter and then use stritrn() to plug in the actual value just before the dialog runs.

              Something like:
              Code:
              browseObj1_browse_definition = <<%xml%
              <browse -------    filter="(A_Date = Var-&gt;appointment_date ) .and. ( alltrim(Type) = &quot;[COLOR="#FF0000"]__anst__[/COLOR]&quot; )"  ----
              -----------
              --------
              ---------
              </browse>
              %xml%
              
              browseObj1_browse_definition = strtran(browseObj1_browse_definition,"__anst__",ans_t)  'the ans_t variable would be appropriately declared earlier on
              
              'Now, display the Xdialog.
              ui_dlg_box(dlg_title,dlg_body,dlg_event)
              Last edited by Tim Kiebert; 06-20-2013, 08:22 PM.
              Tim Kiebert
              Eagle Creek Citrus
              A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

              Comment


                #8
                Re: xDialog Browse quandry

                Interesting example Tim. I'll have to try apply that way.

                I can't remember exactly why I moved the query - I think it was for enable dynamic resetting as a modeless dlg when the filter conditions change and user presses refresh (In the browse). It wouldn't reactivate inside init.
                Shared filter var works for me here.

                Comment


                  #9
                  Re: xDialog Browse quandry

                  Originally posted by Ray in Capetown View Post
                  Interesting example Tim. I'll have to try apply that way.

                  I can't remember exactly why I moved the query - I think it was for enable dynamic resetting as a modeless dlg when the filter conditions change and user presses refresh (In the browse). It wouldn't reactivate inside init.
                  Shared filter var works for me here.

                  That makes sense.

                  re the scope of the variable, I guess it depends on the context. If you declare the var shared within the over all code that calls the xdialog then shared will probably work but I have seen mixed results. That is why I tend not to use variables in the filter itself but resolve to the actual value. (and not just in this case of an embedded browse but in all filters)

                  I use the analogy of a boss sending his secretary out to get all the files that start with a particular letter. However he does not know which letter, Bob down the hall does. He could tell her to go to Bob down the hall to find out which letter (the variable approach, she could forget to ask Bob, she could get lost trying to find him, talk to the wrong Bob, or Bob could have forgotten by the time she gets to him) or the boss could phone Bob and tell her before she leaves his office ( the resolving to a value approach). The first approach is not wrong but I see the second approach succeeding more often than the first so I use the second approach.

                  Tim
                  Tim Kiebert
                  Eagle Creek Citrus
                  A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                  Comment


                    #10
                    Re: xDialog Browse quandry

                    Don't have v11 to test, but try:
                    Code:
                    <browse width="1248" height="711" data_entry_style="modeless" restrict_enter="yes" restrict_change="yes" restrict_delete="yes" restrict_find="yes" restrict_range="yes" restrict_index="yes" restrict_query="yes" gridline_horizontal="yes" gridline_vertical="yes" restrict_column_resize="yes" restrict_column_move="yes" restrict_column_delete="yes" row_height="21" filter="(A_Date = Var-&gt;appointment_date ) .and. ( alltrim(Type)=alltrim(Var-&gt;anst ))" order="toseconds(A_Time)+WORD(Name,2)">

                    Comment


                      #11
                      Re: xDialog Browse quandry

                      Yes true, except if Bob's taken the day off, then we're stuck any which way (that's usually golf Thursday).
                      It will take me awhile to absorb the difference, but I sometimes get it eventually.
                      Gabe , your reply I expect to need some time with too. Thanks.

                      Comment


                        #12
                        Re: xDialog Browse quandry

                        Tim,

                        THANK YOU!!!

                        Works like a charm.

                        My other option was to copy the whole browse definition (420 lines of xml code), hard code the filter, and just go to it on a conditional if statement. (brute force, but it works.)

                        This resolves another issue I have and I can remove a second copy of the browse definition.


                        Again, THANKS!

                        Tom

                        Comment


                          #13
                          Re: xDialog Browse quandry

                          Tom,

                          Your very welcome. Glad it worked for ya.

                          Since this method of displaying the browse uses xml as the definition, lots of possibilities open up as far as dynamically constructing the browse much in the same way that an xdialog definition can be manipulated.
                          Tim Kiebert
                          Eagle Creek Citrus
                          A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                          Comment

                          Working...
                          X