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

Help to learn xdialog, "Invalid data-type

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

    Help to learn xdialog, "Invalid data-type

    I'm trying to self-teach xdialog. my first effort keeps throwing up "Invalid data_type for this expression".

    The Script is as follows: [line numbers added for clarity
    1. 'Created By :
    2. 'Updated By : Graham Wickens
    3. tbl = table.reset("prefix")
    4. tbl.query_detach_all()
    5. query.order = "country"
    6. query.filter = "usage_c"
    7. query.description = "Keylist"
    8. indx = tbl.query_create()
    9. ui_dlg_box("Country List",""%dlg%
    10.Print a mailing label for which customer?;
    {lf};

    11.Select Country Name:;
    12.[%KL=keylist%.50,10key_selected];
    {lf};
    13."*15&OK!ok" "15&Cancel!cancel"

    14.%dlg%,""%code%
    15.IF a_dlg_button = "ok" THEN
    16. tr=:browse.load("Base_Master")
    17. tr:Tables:Base_Master.filter_expression = "country_n = '"+key_selected+"'"
    18. tr:Tables:Base_Master.order_expression = "place_n+base"
    19. tr:Tables:Base_Master.query()
    20. tr.show()
    21. tr.activate()
    22.END IF
    23.%code%)

    the error is on line 17.

    is it possible to get a value from one table and use this value as a filter on another.

    In my case select field"COUNTRY" from Prefix.dbf and use the field value form NAME12 (from same record )to select all entries in table bases.dbf that
    BASES-"Country_n = PREFIX-"NAME12

    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

    #2
    RE: Help to learn xdialog,

    with a lack of response, I finally sorted it out.
    line 17 - 19 should read:
    17.tr=:browse.load("Base_Master")
    tr:tables:bases.filter_expression = "country_n = '"+left(remspecial(key_selected1),12)+"'"
    18. tr:tables:bases.order_expression = "place_n+base"
    19. tr:tables:bases.query()
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

    Comment


      #3
      RE: Help to learn xdialog,

      So Far so good. The next stage I want to pass the key_value from the 1st dialog box to use as the filter in the second dialog box:

      'Date Created: 12-Jun-2002 08:59:55 PM
      'Last Updated: 02-Sep-2005 08:40:00 PM
      'Created By :
      'Updated By : Graham Wickens
      ui_dlg_box("Country",
      Select Country:;
      [%Ke=prefix,{keylist_build('1:25',name12,country)}{usage_c}%.25key_value0];
      {lf};

      %dlg%,
      IF a_dlg_button = "ok" THEN
      c_filter = alltrim(key_value0)
      END IF
      %Code%)
      ui_dlg_box("Region",
      Select Region:;
      [%Ke=regional,{keylist_build('1:3,2:20',region_n,region_n,f_region_n)}{country_n = c_filter}%.23key_value1];
      {lf};

      %dlg%,
      IF a_dlg_button ="ok" THEN
      r_filter = alltrim(key_value1)
      END IF
      %Code%)

      What is the correct way to code the filter expression as I think syntax is the only thing stopping this from working.

      Of course if anyone has a more elegant way of doing this, please let me know.
      --
      Support your local Search and Rescue Unit, Get Lost!

      www.westrowops.co.uk

      Comment


        #4
        RE: Help to learn xdialog,

        Perhaps a better explanation of what I am trying to achieve might get me more response:
        I have 5 Tables:

        Prefix.dbf which holds Country Details
        Regional.dbf which holds Region details for each Country
        County_names.dbf which holds County details for each Region in each Country
        Place_names.dbf which holds Place Name details
        Bases.dbf which holds Airfield details from around the world and contains fields contain lookup values from the above 4 tables.

        using XDialog I want to be able to:
        select a Country [from Prefix]
        select Region or County from 1 above
        if Region selected , select Region_Name in Country selected in 1
        select Place_Name in Region_Name selected in 3
        if [b]County[b] selected, select County_name for Country selected in 1
        select Place_Name in County_name selected in 5
        finally Display browse of [b]Bases[b] filtered by the above selections.

        I managed it in V5.4 and V5 using forms opened as "Dialog" and a lot of xbasic code, it was rather long-winded but it worked, so surely I should be able to achieve a more elegant result using XDialog??
        --
        Support your local Search and Rescue Unit, Get Lost!

        www.westrowops.co.uk

        Comment


          #5
          RE: Help to learn xdialog,

          Hello Graham,

          I'd probably try to approach this with a single dialog box. As I don't have your tables, I used a coupld of simple lists to demonstrate this. You can easily do the same thing by using table to populate lists or arrays.

          Good luck,
          Jim

          Code:
          France:Orleans
          France:Nantes
          France:Paris
          Germany:Berlin
          Germany:Hanover
          Germany:Dresden
          Germany:Mannheim
          USA:Iowa
          USA:Wisconsin
          USA:Nebraska
          USA:Florida
          %b%
          vRegionList = ""
          ui_dlg_box("Country",
          Select Country:; 
          [.40vSelectedCountry^=vCountry!change]; 
          {lf}; 
          {condition=vSelectedCountry''}
          Select Region:;
          [.40vSelectedRegion^=vRegionList];
          {condition=.t.}
            
          %dlg%,
          IF a_dlg_button = "ok" THEN 
          c_filter = alltrim(vSelectedCountry+" "+vSelectedRegion)
          end if 
          if a_dlg_button = "change"
          	a_dlg_button = ""
          	vList = filter_string(vRegion,vSelectedCountry)
          	vList = *for_each(x,word(x,-1),vList)
          	vRegionList = vList 
          END IF 
          %Code%) 
          
          a5_show_variable(c_filter)

          Comment


            #6
            RE: Help to learn xdialog,

            Ooops,

            Didn't get everything copied. Here's another try:

            Code:
            vCountry = 
            England
            France
            Germany
            USA
            %a%
            vRegion = 
            England:North
            England:South
            England:East
            England:West
            France:Tours
            France:Orleans
            France:Nantes
            France:Paris
            Germany:Berlin
            Germany:Hanover
            Germany:Dresden
            Germany:Mannheim
            USA:Iowa
            USA:Wisconsin
            USA:Nebraska
            USA:Florida
            %b%
            vRegionList = ""
            ui_dlg_box("Country",
            Select Country:; 
            [.40vSelectedCountry^=vCountry!change]; 
            {lf}; 
            {condition=vSelectedCountry''}
            Select Region:;
            [.40vSelectedRegion^=vRegionList];
            {condition=.t.}
              
            %dlg%,
            IF a_dlg_button = "ok" THEN 
            c_filter = alltrim(vSelectedCountry+" "+vSelectedRegion)
            end if 
            if a_dlg_button = "change"
            	'debug(1)
            	a_dlg_button = ""
            	vList = filter_string(vRegion,vSelectedCountry)
            	vList = *for_each(x,word(x,-1),vList)
            	vRegionList = vList 
            END IF 
            %Code%) 
            
            a5_show_variable(c_filter)

            Comment


              #7
              RE: Help to learn xdialog,


              So Far so good.
              ui_dlg_box("Airfield Listing",
              Select Country:;
              [%Ke=prefix,{keylist_build('1:25',name12,Country)}{usage_c}%.25vSelectedCountry];
              {lf};
              {condition=SelectedCountry''}

              {condition="R"}
              Select Region:;
              [%Ke=regional,{keylist_build('1:3,2:20',region_n,region_n,f_region_n)}{country_n = SelectedCountry}%.23SelectedRegion];
              {lf};
              {condition="C"}
              [%Ke=county_name,(keylist_build(40,County_Name,County_name}{country_n = SelectedCountry}%23SelectedCounty];
              {lf};
              {condition=.t.}
              %dlg%,
              c_filter=alltrim(SelectedCountry+","+SelectedRegion+","+SelectedCounty)
              %code%)
              a5_show_variable(c_filter)

              I still cannot get the Filter set in {condition="R"} or {Condition="C")
              --
              Support your local Search and Rescue Unit, Get Lost!

              www.westrowops.co.uk

              Comment


                #8
                RE: Help to learn xdialog,

                Graham, permit me to jump in and be a bit blunter than Jim.

                Post sample data from the tables involved. Otherwise you force volunteers who want to try to help you to create their own data, in multiple related tables, and frankly, most of us would rather not. It's fair to say you should try to make it easy for folks to help you.

                -- cranky Tom

                Comment


                  #9
                  RE: Help to learn xdialog,

                  Here you are then a zip called Example, I think its has all that is relevant to the Script. If not just SHOUT!
                  --
                  Support your local Search and Rescue Unit, Get Lost!

                  www.westrowops.co.uk

                  Comment


                    #10
                    RE: Help to learn xdialog,

                    Graham,

                    Here's an action scripting example that uses a series of simple dialog boxes to display a browse on the BASES table filtered on either a Country Name + Region Name OR a Country Name + County Name. Maybe this will give you some ideas.

                    Doing all of this in a single xdialog is beyond me at the moment. Perhaps others will help out.

                    -- tom

                    ps.

                    Your post at 3:37p yesterday isn't clear enough for me. I don't understand the two lines describing the selection of Place_name. They seem to be saying choose Place_name from Region_Name in one case, and Place_name from County_name in another. There is no Place_name field in the Regionals table. There is no table "Region_Name". There is no Place_name field in the County_names table. There is no "County_Name" table. Please break this down into smaller steps. Thanks.

                    Comment


                      #11
                      RE: Help to learn xdialog,

                      Oops. Hit send prematurely.

                      -- tom

                      Comment


                        #12
                        RE: Help to learn xdialog,

                        Thanks Tom, I'm away until Sunday now, but it will give me something to think about.
                        --
                        Support your local Search and Rescue Unit, Get Lost!

                        www.westrowops.co.uk

                        Comment


                          #13
                          RE: Help to learn xdialog,

                          It took a bit of doing, but here's an example using a single xdialog for your review and study. Let me know if you have questions.

                          For the benefit of others, here's a summary of what the xdialog example named "TomsExample" will do.

                          ' This script uses a single xdialog to collect search criteria for use in building
                          ' a filter expression in other scripts (not shown here)
                          '
                          ' Features:
                          ' (a) A Country name is selected using a record list-combo box and the Prefix table
                          ' (b) The user then is given the option of searching by Region or by County.
                          ' (c) If the user chooses Region, a second record list_combo box is presented, using
                          ' records pulled from the Regional table, and filtered on the SelectedCountry.
                          ' (d) If the user chooses County, a different record list-combo box is presented, using
                          ' records pulled from the County_name table, and filtered on the SelectedCountry.
                          ' (e) The display of the region and county combo boxes occurs in the same space, using
                          ' a conditional expression to replace the controls as needed.
                          ' (f) Finally the user's choices are displayed in a simple message box at the end.


                          -- tom

                          Comment


                            #14
                            RE: Help to learn xdialog,

                            Graham,

                            Here's an improved example. The radio button to choose between Region or County is hidden until a country is selected. The OK button is disabled until a region name or county name is selected. This was a great exercise. I'd been away from xdialog for a while and this really knocked the rust off.

                            -- tom

                            Comment


                              #15
                              RE: Help to learn xdialog,

                              Hi Tom,
                              you have been busy while I was away! :))

                              I can now work though it step-by-step to understand it.If I have any questions I will post to the forum.
                              the Xdialog works very fast on the full tables.
                              --
                              Support your local Search and Rescue Unit, Get Lost!

                              www.westrowops.co.uk

                              Comment

                              Working...
                              X