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

Is it Possible to display results of xdialog query in same xdialog?

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

    Is it Possible to display results of xdialog query in same xdialog?

    is it possilbe to show the results of a query by xdialog in the same dialog box or can it only be displayed in another one?

    i.e. in the above example, after setting the query parameters (operator, ICAO or IATA) can I then display the results of this query in the the red coloured area in original xdialog?

    see attachment.
    Attached Files
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

    #2
    Re: Is it Possible to display results of xdialog query in same xdialog?

    You can create a browse to display the records and use the advanced menu to create an xdialog to copy into your script.
    Have a look at this thread HERE
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #3
      Re: Is it Possible to display results of xdialog query in same xdialog?

      Thanks Robin, will have a look.
      --
      Support your local Search and Rescue Unit, Get Lost!

      www.westrowops.co.uk

      Comment


        #4
        Re: Is it Possible to display results of xdialog query in same xdialog?

        this is way, way above my level of understanding of Alpha 5 (been using Alpha 5 in its various editions for 25 years, but only at the hobby level to keep my aviation database up to date), is there a simpler way of doing this?
        --
        Support your local Search and Rescue Unit, Get Lost!

        www.westrowops.co.uk

        Comment


          #5
          Re: Is it Possible to display results of xdialog query in same xdialog?

          Do you have a sample table you can upload here?
          Robin

          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

          Comment


            #6
            Re: Is it Possible to display results of xdialog query in same xdialog?

            ignore
            Last edited by Graham Wickens; 10-05-2019, 04:01 PM.
            --
            Support your local Search and Rescue Unit, Get Lost!

            www.westrowops.co.uk

            Comment


              #7
              Re: Is it Possible to display results of xdialog query in same xdialog?

              Ive stripped out as much as I can.
              Attached Files
              --
              Support your local Search and Rescue Unit, Get Lost!

              www.westrowops.co.uk

              Comment


                #8
                Re: Is it Possible to display results of xdialog query in same xdialog?

                Eventually come up with my own solution:


                Code:
                on error goto error_routine
                DIM form_name as C
                if is_object(topparent.this) then
                	form_name = topparent.name()+".this"
                else
                	form_name = ""
                end if
                DIM SHARED FmtSearchMsg as c = "{C=Red}{B=Tan}"
                DIM SHARED index as n
                DIM SHARED vAircraftType as C 
                DIM SHARED vBaseName as C 
                DIM SHARED vClass as C 
                DIM SHARED vCode as C 
                DIM SHARED vDLsize as n = 6000
                DIM SHARED vDisplayLookup[vDLsize] as p
                DIM SHARED vEndDate as D
                DIM SHARED vField as c 
                DIM SHARED vFilter as c 
                DIM SHARED vFragOption as C 
                DIM SHARED vFragment as C 
                DIM SHARED vOperatorUniq as c 
                DIM SHARED vOption as C 
                DIM SHARED vOrder as c 
                DIM SHARED vPrCountry as C 
                DIM SHARED vPrCountryOpt as C 
                DIM SHARED vPrOpt as C 
                DIM SHARED vProdAcUniq as C 
                DIM SHARED vProdTypeCode as C
                DIM SHARED vReg as C 
                DIM SHARED vSearchMsg as C
                DIM SHARED vStartDate as D
                DIM SHARED vStatus as C 
                DIM SHARED vTable as C = "Logging"
                DIM SHARED vUsage as C 
                DIM SHARED varC_result as C 
                DIM SHARED showArray as l = .f.
                DELETE expression_result
                expression_result = eval("date()",form_name)
                vStartDate = convert_type(expression_result,"D")
                DELETE expression_result
                expression_result = eval("date()",form_name)
                vEndDate = convert_type(expression_result,"D")
                DIM vOperatorUniqDef as C =  "k=appendix_c,{keylist_build(\"H=.05,1:48,2:6.2,3:17\",''+unique,left(''+operator,48),left(''+icao,6.2),left(''+country,17))}{c3 <> \"X\"}"
                DIM vAircraftTypeDef as C = "k=aircraft_type,{keylist_build(\"H=.05,1:40\",''+ac_unique,left(''+aircraft_type,40))}{}"
                DIM vBaseNameDef as C = "k=base_details,{keylist_build(\"H=.05,1:32,2:8,3:16\",''+unique,left(''+base,32),left(''+icao_code,8),left(''+country,16))}{}"
                DIM vClassDef as C = "k=c1,{keylist_build(\"H=.05,1:8,2:25\",''+c1,left(''+c1,8),left(''+description,25))}{}"
                DIM vStatusDef as C = "k=status,{keylist_build(\"H=.05,1:8,2:25\",''+c3,left(''+c3,8),left(''+desc,25))}{}"
                DIM vUsageDef as C = "k=c2,{keylist_build(\"H=.05,1:8,2:25\",''+c2,left(''+c2,8),left(''+description,25))}{}"
                DIM vProdTypeCodeDef as C = "k=aircraft_type,{keylist_build(\"H=.05,1:42\",''+type_code,left(''+aircraft_type,42))}{generic = .t.}"
                DIM vPrCountryDef as C  = "k=prefix,{keylist_build(\"H=.05,1:32\",''+name12,left(''+country,32))}{usage_c = .t.}"
                varC_result = ui_dlg_box("Query Selection",<<%dlg%
                {Background=#234+234+255}
                {xmargin=1,1}
                {removecomments}
                {xmargin=1,1}
                {removecomments}
                {font=Arial,10}
                {region1}
                (vOption:Aircraft Class);
                (vOption:Aircraft Type);
                (vOption:Aircraft Usage);
                (vOption:Base List);
                (vOption:Code);
                (vOption:Dates);
                (vOption:Operator Name);
                (vOption:Production List);
                (vOption:Reg);
                {Line=1,0};
                {condition=(vOption="Aircraft Usage")}
                	{start_pos}{region}
                Usage: [%@vUsageDef%8vUsage!UsageEvent_*];
                {endregion}	
                {condition=(vOption="Aircraft Type")}
                	{start_pos}{region}
                Type: [%@vAircraftTypeDef%.30vAircraftType!AcTypeEvent_*];
                	{endregion}
                {condition=(vOption="Base List")}
                	{start_pos}{region}
                Name: [%@vBaseNameDef%.40vBaseNameUniq!BaseNameEvent_*];
                	{endregion}
                {condition=(vOption="Aircraft Class")}
                	{start_pos}{region}
                Class: [%@vClassDef%.6vClass!ClassEvent_*];
                	{endregion}
                {condition=(vOption="Code")}
                	{start_pos}
                	{region}
                (vCodeOpt:All)(vCodeOpt:Civ)(vCodeOpt:Mil);
                {endregion}
                {region}
                Code: [.8vCode!CodeEvent_*];
                	{endregion}
                {condition=(vOption="Dates")}
                	{start_pos}{region}
                (vDateOpt:Day)(vDateOpt:Month);
                (vDateOpt:Period)(vDateOpt:Week);
                (vDateOpt:Year)(vDateOpt:Location);
                Start: [%DATE;P=popup.calendar(dtoc(vStartDate));I=popup.calendar%.18vStartDate!vStartDate_*];
                {condition=(vOption="Dates".and.vDateOpt="period")}
                End:  [%DATE;P=popup.calendar(dtoc(vEndDate));I=popup.calendar%.18vEndDate!vEndDate_*];
                	{endregion}
                {condition=(vOption="Operator Name")}
                	{start_pos}{region}
                Operator: [%@vOperatorUniqDef%.42vOperatorUniq!OperEvent_*];
                	{endregion}
                {condition=(vOption="Production List")}
                	{start_pos}{region}
                (vPrOpt:MSN)(vPrOpt:Line No);
                (vPrOpt:Assembly no)(vPrOpt:Plane set);
                (vPrOpt:Variant no)(vPrOpt:Centre Fuselage);
                (vPrOpt:Front Fuselage);
                {region}
                (vPrCountryOpt:All) 
                (vPrCountryOpt:Country)
                {condition=(vOption="Production List".and.vPrCountryOpt="Country")}
                [%@vPrCountryDef%.20vPrCountry];
                {condition=(vOption="Production List".and.vPrCountryOpt<>"")}
                Type: [%@vProdTypeCodeDef%.40vProdTypeCode!ProdEvent_*]
                {endregion}
                {condition=(vOption="Status")}
                	{start_pos}{region}
                Status: [%@vStatusDef%.20vStatus!StatusEvent_*];
                	{endRegion}
                {endregion}
                {condition=(vOption="Reg")}
                {condition=(vOption="Reg")}
                	{start_pos}{region}
                Reg/Serial:| [.16vReg!RegEvent_*]
                	{endregion};
                {condition=.t.}
                <%T=Run Query;O={J=C,C}{C=Red}{F=Bookman Old Style,10}{B=Tan}Go%8,1.5!Go>
                <%T=Close Dialog;O={J=C,C}{C=Red}{F=Bookman Old Style,10}{B=Tan}Close%8,1.5!Close>
                {sp=2}{text=30vSearchMsg};
                {endregion1}
                {region3}		
                {region}
                {font=Arial Narrow,8}
                {condition=(showArray=.t.)}
                {sp=1}[%O==FmtCurrLogg(eval(value))%.130,26index^#vdisplayLookup];
                {sp=1}{text=100:vFilter+"~"+vorder+"~"+vOption}
                {font=Arial,10}
                {endregion};
                {endregion3};
                ;{endregion1}
                %dlg%,<<%code%
                trace.writeln(a_dlg_button)
                if left(a_dlg_button,11) = "vStartDate_" then
                	if a_dlg_button = "vStartDate_killfocus" then
                		vStartDate = ctod(dtoc(vStartDate))
                		select
                			case vDateOpt = "Day"
                				vEndDate = vStartDate
                			case vDateOpt = "Month"
                				vEndDate = vStartDate-31
                			case vDateOpt = "Week"
                				vEndDate = vStartDate-8
                			case vDateOpt = "Year"
                				vEnddate = vstartdate-365
                		end select
                		vFilter = "(when >= Var->vStartDate  )  .and. (when <= Var->vEndDate  )"
                		vOrder = "cdate(when)+h+where+reg"
                	end if
                	a_dlg_button = ""
                end if
                
                if left(a_dlg_button,9) = "vEndDate_" then
                	if a_dlg_button = "vEndDate_killfocus" then
                		vEndDate = ctod(dtoc(vEndDate))
                	end if
                	a_dlg_button = ""
                end if
                
                if left(a_dlg_button,12) = "AcTypeEvent_" then
                	if a_dlg_button = "AcTypeEvent_selok" then
                		vFilter = "ac_unique="-quote(rtrim(vAircraftType))
                		vOrder = "REG"
                	end if
                	a_dlg_button= ""
                end if
                
                if left(a_dlg_button,14) = "BaseNameEvent_" then
                	if a_dlg_button = "BaseNameEvent_killfocus" then
                		vFilter = "base_unique="-quote(rtrim(vBaseNameUniq))
                		vOrder = "REG"
                
                	end if
                	a_dlg_button= ""
                end if
                
                if left(a_dlg_button,9) = "RegEvent_" then
                	if a_dlg_button = "RegEvent_killfocus" then
                		vFilter = "(reg="-quote(rtrim(vReg))-".or.as="-quote(rtrim(vReg))-").and.rtrim(Reg)<>'-CANX-'"
                		vOrder = "REG"
                	end if
                	a_dlg_button= ""
                end if
                
                if left(a_dlg_button,12) = "StatusEvent_" then
                	if a_dlg_button = "StatusEvent_killfocus" then
                		vFilter = "status="-quote(vStatus)
                		vOrder = "status+reg"
                	end if
                	a_dlg_button = ""
                end if
                
                if left(a_dlg_button,10) = "CodeEvent_" then
                	if a_dlg_button = "CodeEvent_killfocus" then
                		select
                			case vCodeOpt = "all"
                				vFilter = "status='C'.and.Code="-quote(vCode)-".and.rtrim(Reg)<>'-CANX-'"
                			case vCodeOpt = "civ"
                				vFilter = "status='C'.and.Code="-quote(vCode)-".and.rtrim(Reg)<>'-CANX-'.and. C1<>'M'"
                			case vCodeOpt = "mil"
                				vFilter = "(( '"-vCode-"' $ code ) )  .and. (reg <> '-CANX-'  ) .and. (status = 'C'  ) .and. (c1='M')"
                		end select
                		vCodeOpt = ""
                		vOrder = "Code+reg"
                	end if
                	a_dlg_button = ""
                end if
                
                if left(a_dlg_button,11) = "ClassEvent_" then
                	if a_dlg_button = "ClassEvent_selok" then
                		vFilter = "C1="-quote(vClass)+".and.rtrim(Reg)<>'-CANX-'"
                		vOrder = "C1+REG"
                	end if
                	a_dlg_button = ""
                end if
                
                if left(a_dlg_button,10) = "OperEvent_" then
                	if a_dlg_button = "OperEvent_selok" then
                		vFilter = "op_unique="-quote(vOperatorUniq)+".and.c1='c'"
                		vOrder = "op_unique+reg"
                	end if
                	a_dlg_button = ""
                end if
                
                if left(a_dlg_button,11) = "UsageEvent_" then
                	if a_dlg_button = "UsageEvent_selok" then
                		vFilter = "c2='"-vUsage-"'"
                		vOrder = "c2+reg"
                	end if
                	a_dlg_button = ""
                end if
                
                if left(a_dlg_button,10) = "ProdEvent_" then
                	if a_dlg_button = "ProdEvent_selok" then
                		if vPrCountryOpt = "all" then
                			vFilter = "Type_code="-quote(rtrim(vProdTypeCode))
                		else
                			vFilter = "Type_code="-quote(rtrim(vProdTypeCode))+".and.Country="-quote(rtrim(vPrCountry))
                		end if
                		select
                			case vPrOpt = "MSN"
                				vOrder = "SortMsn"
                			case 	vPrOpt = "Assembly No"
                				vOrder = "Assembly_No"
                			case vPrOpt = "Plane Set"
                				vOrder = "Plane_set"
                			case vPrOpt = "Variant No"
                				vOrder = "Variant_no"
                			case vPrOpt = "Line No"
                				vOrder = "LineNoSort"
                			case vPrOpt = "Centre Fuselage"
                				vOrder = "C_fuselage"
                			case vPrOpt = "Front Fuselage"
                				vOrder = "F_Fuselage"
                		end select
                		vOrder = vOrder+"+REG"
                		vPrCountry = ""
                		a_dlg_button = ""
                	end if
                end if
                if a_dlg_button = "Go" then
                	trace.writeln("vOption="-vOption)
                	trace.writeln("vOrder="-vOrder)
                	trace.writeln("vFilter="-vFilter)
                	if  rtrim(vOrder) = "" .or. rtrim(vFilter) = "" then
                		vSearchMsg = "Invalid Search"
                	else
                		dlCount = tablecount(vTable,vFilter)
                		vDisplayLookup.resize(vdlSize)
                		select
                			case dlCount > 0 .and. dlCount <= vdlsize
                				vdisplayLookup.initialize_from_table(vTable,vFilter,vOrder)
                				nCount = *count(vDisplayLookup.matching("as=''"))
                				vSearchMsg = nCount+" needed from "+dlCount
                				vDisplayLookup.resize(vDisplayLookup.first_empty()-1)
                				showArray = .t.
                			case dlcount > vDlsize 
                				vSearchMsg = "Search Too Large"
                				showarray = .f.
                			case else
                				vSearchMsg = "Search Value Not Found"
                				showArray = .f.
                		end select
                		
                	end if
                	vFilter = ""
                	vOrder= ""
                	vOption=""
                	
                a_dlg_button = ""
                end if
                
                if  a_dlg_button <> "Close" then
                	a_dlg_button = ""
                end if
                %code%)
                end
                error_routine:
                err_msg = error_text_get(error_code_get())
                script = error_script_get()
                line = error_line_number_get()
                ui_msg_box("Error",err_msg+" error occured at line "+alltrim(str(line,4,0))+" in Script "+alltrim(script))
                end
                --
                Support your local Search and Rescue Unit, Get Lost!

                www.westrowops.co.uk

                Comment


                  #9
                  Re: Is it Possible to display results of xdialog query in same xdialog?

                  I copied your table to a new adb - does this script need a form to run? All I get is a dialog with the radio buttons and 'invalid search' when GO is clicked.
                  Robin

                  Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                  Comment


                    #10
                    Re: Is it Possible to display results of xdialog query in same xdialog?

                    This is example code, you wont be able to just run the script as it does possible lookups from seven of my tables to create the resulting array.
                    Basically there are two Regions, Region1 sets parameters for the query and Region3 displays the result when "Go" is clicked. (region2 was removed during development, I forgot to change region3 to region2). The important bit is the "Go" button, which is processed within the %code% section of the xdialog.
                    clicking "GO" initializes the array and sets the show array button.
                    It is far from perfect code, but I am still on a very steep learning curve with xdialog, but does show one solution.

                    Code:
                    if a_dlg_button = "Go" then
                    		dlCount = tablecount(vTable,vFilter)
                    		vDisplayLookup.resize("2000")
                    		if dlCount > 0 then
                    			vdisplayLookup.initialize_from_table(vTable,vFilter,vOrder)
                    			nCount = *count(vDisplayLookup.matching("as=''"))
                    			vSearchMsg = FmtSearchMsg+nCount+" needed"
                    			vDisplayLookup.resize(vDisplayLookup.first_empty()-1)
                    			showArray = .t.
                    		else
                    			vSearchMsg = FmtSearchMsg+"Search Value Not Found"
                    			showArray = .f.
                    		end if
                    	end if
                    	a_dlg_button = ""
                    end if
                    --
                    Support your local Search and Rescue Unit, Get Lost!

                    www.westrowops.co.uk

                    Comment

                    Working...
                    X