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

x_Dialog Tab Stops

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

    #61
    Re: x_Dialog Tab Stops

    Is the parent ID contained in the child record?
    If not , what you can do is get the child record recno(), go to that record, get the linking value from the field that links it. Find that record and read the ID.

    Comment


      #62
      Re: x_Dialog Tab Stops

      Ray,

      I do have the parent id in the child table. When saved the child record, the parent id is empty.

      Can you give me more info?

      How do I set for the Parent id when save a records?

      Comment


        #63
        Re: x_Dialog Tab Stops

        How are you saving the child record?
        The linking field is automatically filled when adding child records on a form as you displayed - as you know I'm sure

        Comment


          #64
          Re: x_Dialog Tab Stops

          Originally posted by johnkoh View Post
          Ray,

          I do have the parent id in the child table. When saved the child record, the parent id is empty.

          Can you give me more info?

          How do I set for the Parent id when save a records?
          Reading again maybe you mean that the id in the parent record is empty, not that the parent id in the child is empty, which it would be if the parent is.?

          Comment


            #65
            Re: x_Dialog Tab Stops

            Hi Ray,

            I have attached the code that I am working on it. It is base on AlphaSports Invoice records.
            I know I missing the LINK between parent and Child table but I do not know how to?


            Code:
            'Displaying Data from a Set
            
            'This script demonstrates how you can use an Xdialog box to display data from a set. It shows data from the invoice.set in the AlphaSports sample application.
            
            'The Main Script
            
            'First, dimension variables and open the set. Exit if the set cannot be found.
            dim shared vInvId as c =""
            'vInvId ="000001"	'for test
            
            dim setname as C
            dim vl as P
            dim s as P
            dim line_number as N
            dim invoice_number as C
            dim invoice_date as D
            dim customer as C
            dim lastname as C
            dim firstname as C
            dim address1 as C
            dim address2 as C
            dim city as C
            dim state as C
            dim zip as C
            dim items as C
            dim direction as C
            dim title_bar as C
            
            setname = "invoice_set.set"
            
            'setname = a5.Get_Exe_Path()+ chr(92) + "samples\alphasports\invoice_set.set"
            
            'if file.exists(setname) = .f. then
            '    ui_msg_box("Error","Cannot run this script because '"+setname+"' not found.")
            '    end
            'end if
            
            vl = local_variables()
            
            on error goto set_did_not_open
            
            s = set.open_session(setname)
             
            
            'Next, open the parent invoice_header table and the child invoice_items table. Initialize variables.
            
            on error goto 0
            
            'get pointer to invoice_header table
            tih = s.invoice_header
            tih.index_primary_put("")
            tih.fetch_first()
            
            'get pointer to invoice_items table
            tii = s.invoice_item
            line_number = 1
            items = ""
            direction = ""
            invoice_number = ""
             
            
            'Start creating the Xdialog with the navigation buttons. Note that the {can_exit} command allows you to close the dialog by clicking the X button at the upper right corner of the dialog. The {startup} command fires the init event, which displays the first records from the parent and child tables.
            'How to insert the Check image at title bar? '{stickto=Center}{image=$$generic.check}{sort_order}
            title_bar = "{F=Arial,8,B}{C=Dark Blue,White,Dark Blue}{B=White,Dark Blue,Blue White}{I:'$$generic.check'}{T=0.25}Quantity{T=0.75}Description{T=3.25}Price{T=4.00}Total"
            
            '[%O={@@};D%.90,1^#title_bar?.f.];
            '[%O={@@};D%.90,5line_number^#items];
            ';;;
            'Want to see the xml browse at here. F9 Save records otherwise will not save it;
            
            ui_modeless_dlg_box("Invoice",<<%dlg%
            {can_exit=close}{startup=init}
            
            {region0}
            
            <%B=T;T=First;I=$a5_record_first;%!first>
            <%B=T;T=Previous;I=$a5_record_previous;%!prev>
            <%B=T;T=Next;I=$a5_record_next;%!next>
            <%B=T;T=Last;I=$a5_record_last;%!last>
            <%B=T;T=Find;I=$a5_find_by_key;%!find>
            ;
             
            
            Create the fields to display the records from the parent table;
             and the list box to display the records from the child table.
            
            {endregion0};
            
            {line=1,0};
            
            {region}
            Invoice Number: |[.20invoice_number];
            Date: |[.20invoice_date];
            Customer:|[.55customer];
            Name:|[.20firstname] [.32lastname];;
            Address1:|[.55address1];
            Address2:|[.55address2];
            City, ST Zip: |[.31city] [.5state] [.12zip];
            {endregion};
            
            {lf};
            
            
            {embedded=150,15:Browse in Xdialog}
            {line=1,0};
            
            {region}
            
            <10&Close!close> ;
            
            {endregion}
             
            %dlg%,<<%code%
            
            'This final block of the main script contains the event handling code, the error handler, and the end command.. Note how the INLIST()function is used to isolate the navigation events in a If ... END IF block.
            
            
            
            if a_dlg_button = "init" then
            
                get_header_variables(vl)
            
                line_number = 1
                'after get the table value, refresh the number
                vInvId = eval("vInvId")
                
            	'call the childDlg, "Browse in Xdialog"
            	xml_showInvitem(vInvId)
            	ui_modeless_dlg_refresh("Browse in Xdialog")
            
            end if
            
            if a_dlg_button = "find" then
            
                find_invoice(vl)
            
                line_number = 1
            
            end if
            
            if a_dlg_button = "close" then
            
                s.close()
            
                ui_modeless_dlg_close("invoice")
            
            end if
            
            if inlist(a_dlg_button,"first","next","prev","last") then
            
                if a_dlg_button = "first" then
            
                    direction = "first"
            
                else if a_dlg_button = "prev" then
            
                    direction = "prev"
            
                else if a_dlg_button = "next" then
            
                    direction = "next"
            
                else if a_dlg_button = "last" then
            
                    direction = "last"
            
                end if
            
                fetch_next(vl)
            
                line_number = 1
            
            end if
            
            %code%)
            
            end
            
            set_did_not_open:
            
            ui_msg_box("Error",setname + " not found, or could not be opened.")
             
            
            'Supporting Functions
            
            'The fetch_next function retrieves the appropriate invoice_header record, ignoring child records (because the fetch level is set to 1). It retrieves the record's field values with the get_header_variables function.
            
            function fetch_next as C (vars as P)
                with vars
                    if direction = "next" then
                        tih.fetch_next(1)
                    else if direction = "prev" then
                        tih.fetch_prev(1)
                    else if direction = "last" then
                        tih.fetch_last(1)
                    else if direction = "first" then
                        tih.fetch_first(1)
                    end if
                    get_header_variables(vl)
                end with
            end function
             
            
            'The get_header_variables function reads the current invoice_header record and assigns the values to the fields of the Xdialog with the get_items function.
            
            function get_header_variables as v (vars as P)
                with vars
            		vInvId = tih.eval("invoice_number")
                    invoice_number = tih.eval("invoice_number")
                    invoice_date = tih.eval("Date")
            
                    lastname = tih.eval("customer->lastname")
                    firstname = tih.eval("customer->firstname")
                    company = tih.eval("customer->company")
                    address1 = tih.eval("customer->Bill_Address_1")
                    address2 = tih.eval("customer->Bill_Address_2")
                    city = tih.eval("customer->Bill_City")
                    state = tih.eval("customer->Bill_State_Region")
                    zip = tih.eval("customer->Bill_Postal_Code")
            
                    get_items(vl)
            		'msgbox("what is Invoice?",vInvId)
            		
            		'InvoiceItem_ShowXml(vInvId,local_variables())
            		'invoiceItem_xml_2(vInvId)						'Restrict
            		xml_showInvitem(vInvid)
            		ui_modeless_dlg_refresh("Invoice")
                end with
            
            end function
             
            
            'The get_items function builds a list of child records for the current invoice_header record. The function applies the formatting to the list that the Xdialog list box control requires with the A5_OWNER_DRAW_LIST_FMT()function.
            
            function get_items as C (vars as P)
                   with vars
                    items = ""
                    tii.fetch_first()
                    while .not. tii.fetch_eof()
                        items = items + tii.eval("quantity + '|'+description+'|'+ price + '|' + alltrim(str((quantity*price),12,2,'$'))")+ crlf()
                        tii.fetch_next()
                    end while
            
            		Dim format as P
                    Format.tab_stops=".5,3,3.75"
                    Format.odd_row_color="White"
                    Format.even_row_color="Blue White"
                    Format.odd_selected_color="Dark Blue"
                    Format.even_selected_color="Dark Blue"
                    Format.font="Arial,8"
                    Format.font_color_unselected="Black"
                    Format.font_color_selected="White"
                    Format.lastbutton="OK"
                    Format.group_size=1
                    Format.number_rows=.t.
                    Format.alternating_bands=.t.
            
            		'Apply 'owner draw' formatting information to the list
            
                    items = a5_owner_draw_list_fmt(items,Format)
            
                end with
            end function
             
            
            'The find_invoice displays a popup menu of search alternatives. It then displays an Xdialog that accepts the search parameter. Depending on the user's choice, it sets the order of records using either the <TBL>.INDEX_PRIMARY_PUT()or  <TBL>.ORDER()methods. It then finds the next matching record using either the <TBL>.FETCH_GOTO()or <TBL>.FETCH_FIND()methods. It uses the get_header_variables function to display the results. [Picture]
            
            function find_invoice as C (vars as P)
                with vars
            menu_choices = <<%list%
            Record Number
            Invoice Number
            Lastname
            %list%
            
                    result = ui_popup_menu(menu_choices)
            
                    text_prompt = alltrim(result) + ":"
                    find_what = ""
                    if result = "" then
                        exit function
                    end if
            
            find_result = ui_dlg_box("Find Invoice by " + result,<<%dlg%
            {on_key=enter}
            {lf};
            {text=25,1:text_prompt} [.20find_what] {sp};;
            {lf};
            {line=1,0};
            <10&Find!find?.not.(find_what="")> <10&Cancel!cancel>;
            %dlg%)
            
                    if (find_result = "find") .or. (find_result = "enter") then
                        if (find_what <> "") then
                            if result = "record number" then
                                tih.index_primary_put("")
                                tih.fetch_goto(val(find_what))
                                get_header_variables(vl)
                            else if result = "invoice number" then
                                tih.order("invoice_number")
                                tih.fetch_find(find_what)
                                get_header_variables(vl)
                            else if result = "lastname" then
                                tih.order("customer->lastname")
                                tih.fetch_find(find_what)
                                get_header_variables(vl)
                            end if
                        end if
                    end if
                end with
            end function
            
            'xml browse
            
            FUNCTION xml_showInvitem AS C (vInvhdrId AS C )
            dim dlg_title as c 
            dim dlg_body as c 
            dim dlg_event as c 
            dim browseObj1_browse_definition as c 
            dim browseObj1_tablename as c 
            
            browseObj1_tablename = "invoice_item.dbf"
            
            dim flagIsActiveLinkTable as l 
            flagIsActiveLinkTable = a5_is_activelinktable("invoice_item.dbf")
            
            'If the browse is based on an ActiveLink table then it is necessary to include
            'the {statusarea} directive in the Xdialog definition. This is where progress is reported
            'when the active-link table is fetching records from the server.
            dim StatusAreaCommand as c = ""
            if flagIsActiveLinkTable then 
            	StatusAreaCommand = "{sp=.5}{statusarea=100,1};"
            end if 
            
            dlg_title = "Browse in Xdialog"
            
            dlg_body = <<%dlg%
            'If you include the {removecomments} command, any line that starts with an single quote will be treated as a comment.
            {removecomments}
            {can_exit=close}
            {startup=init}
            {xmargin=0}{ymargin=0}
            {stretch=height,width}
            {watch=browseObj1.mode_get()!modechange}
            {card=150,20BrowseCard_browseObj1};
            {stretch=}
            {stickto=bottom,left}
            __StatusArea__;
            <%T=Go to first record;B=T;I=$$navigate.first%!browseObj1_NavigateFirst>
            <%T=Go to previous record;B=T;I=$$navigate.prev%!browseObj1_NavigatePrevious>
            <%T=Go to next record;B=T;I=$$navigate.next%!browseObj1_NavigateNext>
            <%T=Go to last record;B=T;I=$$navigate.last%!browseObj1_NavigateLast>
            {sp=3}
            
            <%T=Find by key;B=T;I=$a5_find_by_key%!browseObj1_FindByKey>
            {sp=3}
            <%T=Sort in ascending order;B=T;I=$$sort%!browseObj1_SortAscending>
            <%T=Sort in descending order;B=T;I=$$sort.descending%!browseObj1_SortDescending>
            {sp=3}
            <%T=Save record;B=T;I=$a5_save%!browseObj1_SaveRecord?.not.(browseObj1.mode_get()="view")>
            {sp=3}
            <%T=Refresh;B=T;I=$$generic.refresh.color%!browseObj1_RefreshRecord?(browseObj1.mode_get()="view")>
            ;
            
            {stickto=bottom,right}
            {justify=right}
            ;;;
            <10&Close!close>;
            
            
            %dlg%
            
            dlg_body = stritran(dlg_body,"__StatusArea__",StatusAreaCommand)
            
            
            dlg_event = <<%code%
            if a_dlg_button = "close" then 
            	ui_modeless_dlg_close(dlg_title)
            end if 
            if a_dlg_button = "init"
                    a_dlg_button = ""    
                    browseObj1 = a5_XdialogDefaultBrowse(dlg_title,"Browsecard_browseObj1",browseObj1_tablename,"browseObj1_browse_definition")
                    'The status bar is only shown if the browse is based on an active-link table.
                    'When the browse is fetching data from the server, the status bar displays progress.
                    'However, when the browse is not fetching from the server, if the 'status_format' is not set to null, then 
                    'the status bar will display 'Record x'. Since we don't want any display, we set the status_format to null.
                    'Note that the status_format can be set to any expression that evaluates in the context of the current record.
                    'e.g. "Record for" + lastname
                    browseObj1.Status_format = "\"\""
                    'find the records
                    browseObj1.queryrun("invoice_number="+quote(vInvhdrId))
            end if
            
            if a_dlg_button = "browseObj1_NavigateFirst" then 
            	a_dlg_button = ""
            	browseObj1.Fetch_First()
            else if a_dlg_button = "browseObj1_NavigateNext" then 
            	a_dlg_button = ""
            	browseObj1.Fetch_Next()
            
            else if a_dlg_button = "browseObj1_NavigatePrevious" then 
            	a_dlg_button = ""
            	browseObj1.Fetch_Prev()
            else if a_dlg_button = "browseObj1_NavigateLast" then 
            	a_dlg_button = ""
            	browseObj1.Fetch_Last()
            else if a_dlg_button = "browseObj1_FindByKey" then 
            	a_dlg_button = ""
            	browseObj1.Find()
            
            else if a_dlg_button = "browseObj1_SortAscending" then 
            	a_dlg_button = ""
            	browseObj1.command("SORT_ASCENDING")
            else if a_dlg_button = "browseObj1_SortDescending" then 
            	a_dlg_button = ""
            	browseObj1.command("SORT_DESCENDING")
            
            else if a_dlg_button = "browseObj1_SaveRecord" then 
            	a_dlg_button = ""
            	browseObj1.commit()
            else if a_dlg_button = "browseObj1_RefreshRecord" then 
            	a_dlg_button = ""
            	browseObj1.command("REFRESH")
            end if 
            
            %code%
            
            browseObj1_browse_definition = <<%xml%
            <browse width="1294" height="698" gridline_horizontal="yes" gridline_vertical="yes" restrict_split="yes" data_entry_style="default" row_height="16">
            <title showtitles="yes" color="#155,176,252" accent_color="White" fill_style="Gradient Horizontal Glass" line_style="solid" line_color="#96,95,149" top="2" onclick_behaviour="Select">
            	<font color="Black" name="Tahoma" size="8" bold="yes"/>
            	<flyover color="#224,244,244" accent_color="#195,195,195" fill_style="Gradient Horizontal"/>
            	<selected color="#214,224,254" accent_color="#155,176,252" fill_style="Gradient Horizontal Middle" font_color="Black"/>
            	<focused color="#214,224,254" accent_color="#155,176,252" fill_style="Gradient Horizontal Middle" font_color="Black"/>
            </title>
            <background color="White" accent_color="Black" fill_style="Transparent"/>
            <row_selector color="#178,198,250" accent_color="Black" fill_style="Solid" line_style="solid" line_color="#96,95,149">
            	<selected color="#214,224,254" accent_color="#178,198,250" fill_style="Transparent"/>
            	<focused color="#214,224,254" accent_color="Black" fill_style="Transparent"/>
            </row_selector>
            <splitter color="#178,198,250"/>
            <horizontal line_color="#215,226,253" line_style="solid"/>
            <vertical line_color="#215,226,253" line_style="solid"/>
            <separator_top line_style="default"/>
            <separator_left line_style="default"/>
            <separator_right line_style="default"/>
            <cells>
            	<cell color="#255,255,255" accent_color="#0,0,0" fill_style="Solid" font_color="#0,0,0" count="1"/>
            	<cell color="#215,226,253" accent_color="#249,251,255" fill_style="Gradient Horizontal Middle" font_color="#0,0,0" count="1"/>
            </cells>
            <selected color="System-Highlight" accent_color="Black" fill_style="Transparent" font_color="System-HighlightText"/>
            <focused color="System-Highlight" accent_color="Black" fill_style="Transparent" font_color="System-HighlightText"/>
            <currentrow color="System-Highlight" accent_color="Black" fill_style="Transparent" font_color="System-HighlightText"/>
            <currentcolumn color="System-Highlight" accent_color="Black" fill_style="Transparent" font_color="System-HighlightText"/>
            <new_record_appearance color="Win3D" accent_color="Black" fill_style="Transparent"/>
            <font name="Tahoma" size="2"/>
            <font name="Tahoma" size="2"/>
            <columns>
            	<column name="Invoice_Number" align="Left" text_format="None">
            		<font color="Wintext" name="Tahoma" size="8"/>
            		<border color="Black" style="No border" width="1" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
            		<fill color="&lt;default&gt;" accent_color="&lt;default&gt;" style="Transparent"/>
            		<shadow style="None"/>
            		<entry name="invoice_item-&gt;INVOICE_NUMBER" width="6"/>
            		<object name="Invoice_Number" column_title="Invoice Number" width="1.010416666666667"/>
            	</column>
            	<column name="Quantity" align="Left" text_format="None">
            		<font color="&lt;default&gt;" name="Tahoma" size="8"/>
            		<border color="Black" style="No border" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
            		<fill color="&lt;default&gt;" accent_color="White" style="Transparent"/>
            		<shadow style="None"/>
            		<entry name="invoice_item-&gt;QUANTITY" width="5"/>
            		<object name="Quantity" column_title="Quantity" width="0.541666666666667"/>
            	</column>
            	<column name="Product_Id" align="Left" text_format="None">
            		<font color="&lt;default&gt;" name="Tahoma" size="8"/>
            		<border color="Black" style="No border" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
            		<fill color="&lt;default&gt;" accent_color="White" style="Transparent"/>
            		<shadow style="None"/>
            		<entry name="invoice_item-&gt;PRODUCT_ID" width="12"/>
            		<object name="Product_Id" column_title="Product Id" width="3.03125"/>
            	</column>
            	<column name="Retail_Price" align="Right" text_format="None">
            		<font color="&lt;default&gt;" name="Tahoma" size="8"/>
            		<border color="Black" style="No border" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
            		<fill color="&lt;default&gt;" accent_color="White" style="Transparent"/>
            		<shadow style="None"/>
            		<entry name="invoice_item-&gt;PRICE" width="8" dec="2" format=",B"/>
            		<object name="Retail_Price" column_title="Retail Price" width="0.760416666666667"/>
            	</column>
            	<column name="Extension" align="Right" text_format="None">
            		<font color="&lt;default&gt;" name="Tahoma" size="8"/>
            		<border color="Black" style="No border" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
            		<fill color="&lt;default&gt;" accent_color="White" style="Transparent"/>
            		<shadow style="None"/>
            		<entry name="invoice_item-&gt;EXTENSION" width="9" dec="2" format=",B"/>
            		<object name="Extension" column_title="Extension" width="0.885416666666667"/>
            	</column>
            </columns>
            </browse>
            %xml%
            
            'Now, display the Xdialog.
            ui_modeless_dlg_box(dlg_title,dlg_body,dlg_event)
            
            	
            END FUNCTION

            Comment


              #66
              Re: x_Dialog Tab Stops

              Originally posted by johnkoh View Post
              Hi Ray,

              I have attached the code that I am working on it. It is base on AlphaSports Invoice records.
              I know I missing the LINK between parent and Child table but I do not know how to?


              Code:
              'Displaying Data from a Set
              
              'This script demonstrates how you can use an Xdialog box to display data from a set. It shows data from the invoice.set in the AlphaSports sample application.
              
              'The Main Script
              
              'First, dimension variables and open the set. Exit if the set cannot be found.
              dim shared vInvId as c =""
              'vInvId ="000001"	'for test
              
              dim setname as C
              dim vl as P
              dim s as P
              dim line_number as N
              dim invoice_number as C
              dim invoice_date as D
              dim customer as C
              dim lastname as C
              dim firstname as C
              dim address1 as C
              dim address2 as C
              dim city as C
              dim state as C
              dim zip as C
              dim items as C
              dim direction as C
              dim title_bar as C
              
              setname = "invoice_set.set"
              
              'setname = a5.Get_Exe_Path()+ chr(92) + "samples\alphasports\invoice_set.set"
              
              'if file.exists(setname) = .f. then
              '    ui_msg_box("Error","Cannot run this script because '"+setname+"' not found.")
              '    end
              'end if
              
              vl = local_variables()
              
              on error goto set_did_not_open
              
              s = set.open_session(setname)
               
              
              'Next, open the parent invoice_header table and the child invoice_items table. Initialize variables.
              
              on error goto 0
              
              'get pointer to invoice_header table
              tih = s.invoice_header
              tih.index_primary_put("")
              tih.fetch_first()
              
              'get pointer to invoice_items table
              tii = s.invoice_item
              line_number = 1
              items = ""
              direction = ""
              invoice_number = ""
               
              
              'Start creating the Xdialog with the navigation buttons. Note that the {can_exit} command allows you to close the dialog by clicking the X button at the upper right corner of the dialog. The {startup} command fires the init event, which displays the first records from the parent and child tables.
              'How to insert the Check image at title bar? '{stickto=Center}{image=$$generic.check}{sort_order}
              title_bar = "{F=Arial,8,B}{C=Dark Blue,White,Dark Blue}{B=White,Dark Blue,Blue White}{I:'$$generic.check'}{T=0.25}Quantity{T=0.75}Description{T=3.25}Price{T=4.00}Total"
              
              '[%O={@@};D%.90,1^#title_bar?.f.];
              '[%O={@@};D%.90,5line_number^#items];
              ';;;
              'Want to see the xml browse at here. F9 Save records otherwise will not save it;
              
              ui_modeless_dlg_box("Invoice",<<%dlg%
              {can_exit=close}{startup=init}
              
              {region0}
              
              <%B=T;T=First;I=$a5_record_first;%!first>
              <%B=T;T=Previous;I=$a5_record_previous;%!prev>
              <%B=T;T=Next;I=$a5_record_next;%!next>
              <%B=T;T=Last;I=$a5_record_last;%!last>
              <%B=T;T=Find;I=$a5_find_by_key;%!find>
              ;
               
              
              Create the fields to display the records from the parent table;
               and the list box to display the records from the child table.
              
              {endregion0};
              
              {line=1,0};
              
              {region}
              Invoice Number: |[.20invoice_number];
              Date: |[.20invoice_date];
              Customer:|[.55customer];
              Name:|[.20firstname] [.32lastname];;
              Address1:|[.55address1];
              Address2:|[.55address2];
              City, ST Zip: |[.31city] [.5state] [.12zip];
              {endregion};
              
              {lf};
              
              
              {embedded=150,15:Browse in Xdialog}
              {line=1,0};
              
              {region}
              
              <10&Close!close> ;
              
              {endregion}
               
              %dlg%,<<%code%
              
              'This final block of the main script contains the event handling code, the error handler, and the end command.. Note how the INLIST()function is used to isolate the navigation events in a If ... END IF block.
              
              
              
              if a_dlg_button = "init" then
              
                  get_header_variables(vl)
              
                  line_number = 1
                  'after get the table value, refresh the number
                  vInvId = eval("vInvId")
                  
              	'call the childDlg, "Browse in Xdialog"
              	xml_showInvitem(vInvId)
              	ui_modeless_dlg_refresh("Browse in Xdialog")
              
              end if
              
              if a_dlg_button = "find" then
              
                  find_invoice(vl)
              
                  line_number = 1
              
              end if
              
              if a_dlg_button = "close" then
              
                  s.close()
              
                  ui_modeless_dlg_close("invoice")
              
              end if
              
              if inlist(a_dlg_button,"first","next","prev","last") then
              
                  if a_dlg_button = "first" then
              
                      direction = "first"
              
                  else if a_dlg_button = "prev" then
              
                      direction = "prev"
              
                  else if a_dlg_button = "next" then
              
                      direction = "next"
              
                  else if a_dlg_button = "last" then
              
                      direction = "last"
              
                  end if
              
                  fetch_next(vl)
              
                  line_number = 1
              
              end if
              
              %code%)
              
              end
              
              set_did_not_open:
              
              ui_msg_box("Error",setname + " not found, or could not be opened.")
               
              
              'Supporting Functions
              
              'The fetch_next function retrieves the appropriate invoice_header record, ignoring child records (because the fetch level is set to 1). It retrieves the record's field values with the get_header_variables function.
              
              function fetch_next as C (vars as P)
                  with vars
                      if direction = "next" then
                          tih.fetch_next(1)
                      else if direction = "prev" then
                          tih.fetch_prev(1)
                      else if direction = "last" then
                          tih.fetch_last(1)
                      else if direction = "first" then
                          tih.fetch_first(1)
                      end if
                      get_header_variables(vl)
                  end with
              end function
               
              
              'The get_header_variables function reads the current invoice_header record and assigns the values to the fields of the Xdialog with the get_items function.
              
              function get_header_variables as v (vars as P)
                  with vars
              		vInvId = tih.eval("invoice_number")
                      invoice_number = tih.eval("invoice_number")
                      invoice_date = tih.eval("Date")
              
                      lastname = tih.eval("customer->lastname")
                      firstname = tih.eval("customer->firstname")
                      company = tih.eval("customer->company")
                      address1 = tih.eval("customer->Bill_Address_1")
                      address2 = tih.eval("customer->Bill_Address_2")
                      city = tih.eval("customer->Bill_City")
                      state = tih.eval("customer->Bill_State_Region")
                      zip = tih.eval("customer->Bill_Postal_Code")
              
                      get_items(vl)
              		'msgbox("what is Invoice?",vInvId)
              		
              		'InvoiceItem_ShowXml(vInvId,local_variables())
              		'invoiceItem_xml_2(vInvId)						'Restrict
              		xml_showInvitem(vInvid)
              		ui_modeless_dlg_refresh("Invoice")
                  end with
              
              end function
               
              
              'The get_items function builds a list of child records for the current invoice_header record. The function applies the formatting to the list that the Xdialog list box control requires with the A5_OWNER_DRAW_LIST_FMT()function.
              
              function get_items as C (vars as P)
                     with vars
                      items = ""
                      tii.fetch_first()
                      while .not. tii.fetch_eof()
                          items = items + tii.eval("quantity + '|'+description+'|'+ price + '|' + alltrim(str((quantity*price),12,2,'$'))")+ crlf()
                          tii.fetch_next()
                      end while
              
              		Dim format as P
                      Format.tab_stops=".5,3,3.75"
                      Format.odd_row_color="White"
                      Format.even_row_color="Blue White"
                      Format.odd_selected_color="Dark Blue"
                      Format.even_selected_color="Dark Blue"
                      Format.font="Arial,8"
                      Format.font_color_unselected="Black"
                      Format.font_color_selected="White"
                      Format.lastbutton="OK"
                      Format.group_size=1
                      Format.number_rows=.t.
                      Format.alternating_bands=.t.
              
              		'Apply 'owner draw' formatting information to the list
              
                      items = a5_owner_draw_list_fmt(items,Format)
              
                  end with
              end function
               
              
              'The find_invoice displays a popup menu of search alternatives. It then displays an Xdialog that accepts the search parameter. Depending on the user's choice, it sets the order of records using either the <TBL>.INDEX_PRIMARY_PUT()or  <TBL>.ORDER()methods. It then finds the next matching record using either the <TBL>.FETCH_GOTO()or <TBL>.FETCH_FIND()methods. It uses the get_header_variables function to display the results. [Picture]
              
              function find_invoice as C (vars as P)
                  with vars
              menu_choices = <<%list%
              Record Number
              Invoice Number
              Lastname
              %list%
              
                      result = ui_popup_menu(menu_choices)
              
                      text_prompt = alltrim(result) + ":"
                      find_what = ""
                      if result = "" then
                          exit function
                      end if
              
              find_result = ui_dlg_box("Find Invoice by " + result,<<%dlg%
              {on_key=enter}
              {lf};
              {text=25,1:text_prompt} [.20find_what] {sp};;
              {lf};
              {line=1,0};
              <10&Find!find?.not.(find_what="")> <10&Cancel!cancel>;
              %dlg%)
              
                      if (find_result = "find") .or. (find_result = "enter") then
                          if (find_what <> "") then
                              if result = "record number" then
                                  tih.index_primary_put("")
                                  tih.fetch_goto(val(find_what))
                                  get_header_variables(vl)
                              else if result = "invoice number" then
                                  tih.order("invoice_number")
                                  tih.fetch_find(find_what)
                                  get_header_variables(vl)
                              else if result = "lastname" then
                                  tih.order("customer->lastname")
                                  tih.fetch_find(find_what)
                                  get_header_variables(vl)
                              end if
                          end if
                      end if
                  end with
              end function
              
              'xml browse
              
              FUNCTION xml_showInvitem AS C (vInvhdrId AS C )
              dim dlg_title as c 
              dim dlg_body as c 
              dim dlg_event as c 
              dim browseObj1_browse_definition as c 
              dim browseObj1_tablename as c 
              
              browseObj1_tablename = "invoice_item.dbf"
              
              dim flagIsActiveLinkTable as l 
              flagIsActiveLinkTable = a5_is_activelinktable("invoice_item.dbf")
              
              'If the browse is based on an ActiveLink table then it is necessary to include
              'the {statusarea} directive in the Xdialog definition. This is where progress is reported
              'when the active-link table is fetching records from the server.
              dim StatusAreaCommand as c = ""
              if flagIsActiveLinkTable then 
              	StatusAreaCommand = "{sp=.5}{statusarea=100,1};"
              end if 
              
              dlg_title = "Browse in Xdialog"
              
              dlg_body = <<%dlg%
              'If you include the {removecomments} command, any line that starts with an single quote will be treated as a comment.
              {removecomments}
              {can_exit=close}
              {startup=init}
              {xmargin=0}{ymargin=0}
              {stretch=height,width}
              {watch=browseObj1.mode_get()!modechange}
              {card=150,20BrowseCard_browseObj1};
              {stretch=}
              {stickto=bottom,left}
              __StatusArea__;
              <%T=Go to first record;B=T;I=$$navigate.first%!browseObj1_NavigateFirst>
              <%T=Go to previous record;B=T;I=$$navigate.prev%!browseObj1_NavigatePrevious>
              <%T=Go to next record;B=T;I=$$navigate.next%!browseObj1_NavigateNext>
              <%T=Go to last record;B=T;I=$$navigate.last%!browseObj1_NavigateLast>
              {sp=3}
              
              <%T=Find by key;B=T;I=$a5_find_by_key%!browseObj1_FindByKey>
              {sp=3}
              <%T=Sort in ascending order;B=T;I=$$sort%!browseObj1_SortAscending>
              <%T=Sort in descending order;B=T;I=$$sort.descending%!browseObj1_SortDescending>
              {sp=3}
              <%T=Save record;B=T;I=$a5_save%!browseObj1_SaveRecord?.not.(browseObj1.mode_get()="view")>
              {sp=3}
              <%T=Refresh;B=T;I=$$generic.refresh.color%!browseObj1_RefreshRecord?(browseObj1.mode_get()="view")>
              ;
              
              {stickto=bottom,right}
              {justify=right}
              ;;;
              <10&Close!close>;
              
              
              %dlg%
              
              dlg_body = stritran(dlg_body,"__StatusArea__",StatusAreaCommand)
              
              
              dlg_event = <<%code%
              if a_dlg_button = "close" then 
              	ui_modeless_dlg_close(dlg_title)
              end if 
              if a_dlg_button = "init"
                      a_dlg_button = ""    
                      browseObj1 = a5_XdialogDefaultBrowse(dlg_title,"Browsecard_browseObj1",browseObj1_tablename,"browseObj1_browse_definition")
                      'The status bar is only shown if the browse is based on an active-link table.
                      'When the browse is fetching data from the server, the status bar displays progress.
                      'However, when the browse is not fetching from the server, if the 'status_format' is not set to null, then 
                      'the status bar will display 'Record x'. Since we don't want any display, we set the status_format to null.
                      'Note that the status_format can be set to any expression that evaluates in the context of the current record.
                      'e.g. "Record for" + lastname
                      browseObj1.Status_format = "\"\""
                      'find the records
                      browseObj1.queryrun("invoice_number="+quote(vInvhdrId))
              end if
              
              if a_dlg_button = "browseObj1_NavigateFirst" then 
              	a_dlg_button = ""
              	browseObj1.Fetch_First()
              else if a_dlg_button = "browseObj1_NavigateNext" then 
              	a_dlg_button = ""
              	browseObj1.Fetch_Next()
              
              else if a_dlg_button = "browseObj1_NavigatePrevious" then 
              	a_dlg_button = ""
              	browseObj1.Fetch_Prev()
              else if a_dlg_button = "browseObj1_NavigateLast" then 
              	a_dlg_button = ""
              	browseObj1.Fetch_Last()
              else if a_dlg_button = "browseObj1_FindByKey" then 
              	a_dlg_button = ""
              	browseObj1.Find()
              
              else if a_dlg_button = "browseObj1_SortAscending" then 
              	a_dlg_button = ""
              	browseObj1.command("SORT_ASCENDING")
              else if a_dlg_button = "browseObj1_SortDescending" then 
              	a_dlg_button = ""
              	browseObj1.command("SORT_DESCENDING")
              
              else if a_dlg_button = "browseObj1_SaveRecord" then 
              	a_dlg_button = ""
              	browseObj1.commit()
              else if a_dlg_button = "browseObj1_RefreshRecord" then 
              	a_dlg_button = ""
              	browseObj1.command("REFRESH")
              end if 
              
              %code%
              
              browseObj1_browse_definition = <<%xml%
              <browse width="1294" height="698" gridline_horizontal="yes" gridline_vertical="yes" restrict_split="yes" data_entry_style="default" row_height="16">
              <title showtitles="yes" color="#155,176,252" accent_color="White" fill_style="Gradient Horizontal Glass" line_style="solid" line_color="#96,95,149" top="2" onclick_behaviour="Select">
              	<font color="Black" name="Tahoma" size="8" bold="yes"/>
              	<flyover color="#224,244,244" accent_color="#195,195,195" fill_style="Gradient Horizontal"/>
              	<selected color="#214,224,254" accent_color="#155,176,252" fill_style="Gradient Horizontal Middle" font_color="Black"/>
              	<focused color="#214,224,254" accent_color="#155,176,252" fill_style="Gradient Horizontal Middle" font_color="Black"/>
              </title>
              <background color="White" accent_color="Black" fill_style="Transparent"/>
              <row_selector color="#178,198,250" accent_color="Black" fill_style="Solid" line_style="solid" line_color="#96,95,149">
              	<selected color="#214,224,254" accent_color="#178,198,250" fill_style="Transparent"/>
              	<focused color="#214,224,254" accent_color="Black" fill_style="Transparent"/>
              </row_selector>
              <splitter color="#178,198,250"/>
              <horizontal line_color="#215,226,253" line_style="solid"/>
              <vertical line_color="#215,226,253" line_style="solid"/>
              <separator_top line_style="default"/>
              <separator_left line_style="default"/>
              <separator_right line_style="default"/>
              <cells>
              	<cell color="#255,255,255" accent_color="#0,0,0" fill_style="Solid" font_color="#0,0,0" count="1"/>
              	<cell color="#215,226,253" accent_color="#249,251,255" fill_style="Gradient Horizontal Middle" font_color="#0,0,0" count="1"/>
              </cells>
              <selected color="System-Highlight" accent_color="Black" fill_style="Transparent" font_color="System-HighlightText"/>
              <focused color="System-Highlight" accent_color="Black" fill_style="Transparent" font_color="System-HighlightText"/>
              <currentrow color="System-Highlight" accent_color="Black" fill_style="Transparent" font_color="System-HighlightText"/>
              <currentcolumn color="System-Highlight" accent_color="Black" fill_style="Transparent" font_color="System-HighlightText"/>
              <new_record_appearance color="Win3D" accent_color="Black" fill_style="Transparent"/>
              <font name="Tahoma" size="2"/>
              <font name="Tahoma" size="2"/>
              <columns>
              	<column name="Invoice_Number" align="Left" text_format="None">
              		<font color="Wintext" name="Tahoma" size="8"/>
              		<border color="Black" style="No border" width="1" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
              		<fill color="<default>" accent_color="<default>" style="Transparent"/>
              		<shadow style="None"/>
              		<entry name="invoice_item->INVOICE_NUMBER" width="6"/>
              		<object name="Invoice_Number" column_title="Invoice Number" width="1.010416666666667"/>
              	</column>
              	<column name="Quantity" align="Left" text_format="None">
              		<font color="<default>" name="Tahoma" size="8"/>
              		<border color="Black" style="No border" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
              		<fill color="<default>" accent_color="White" style="Transparent"/>
              		<shadow style="None"/>
              		<entry name="invoice_item->QUANTITY" width="5"/>
              		<object name="Quantity" column_title="Quantity" width="0.541666666666667"/>
              	</column>
              	<column name="Product_Id" align="Left" text_format="None">
              		<font color="<default>" name="Tahoma" size="8"/>
              		<border color="Black" style="No border" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
              		<fill color="<default>" accent_color="White" style="Transparent"/>
              		<shadow style="None"/>
              		<entry name="invoice_item->PRODUCT_ID" width="12"/>
              		<object name="Product_Id" column_title="Product Id" width="3.03125"/>
              	</column>
              	<column name="Retail_Price" align="Right" text_format="None">
              		<font color="<default>" name="Tahoma" size="8"/>
              		<border color="Black" style="No border" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
              		<fill color="<default>" accent_color="White" style="Transparent"/>
              		<shadow style="None"/>
              		<entry name="invoice_item->PRICE" width="8" dec="2" format=",B"/>
              		<object name="Retail_Price" column_title="Retail Price" width="0.760416666666667"/>
              	</column>
              	<column name="Extension" align="Right" text_format="None">
              		<font color="<default>" name="Tahoma" size="8"/>
              		<border color="Black" style="No border" has_left_edge="yes" has_right_edge="yes" has_top_edge="yes" has_bottom_edge="yes"/>
              		<fill color="<default>" accent_color="White" style="Transparent"/>
              		<shadow style="None"/>
              		<entry name="invoice_item->EXTENSION" width="9" dec="2" format=",B"/>
              		<object name="Extension" column_title="Extension" width="0.885416666666667"/>
              	</column>
              </columns>
              </browse>
              %xml%
              
              'Now, display the Xdialog.
              ui_modeless_dlg_box(dlg_title,dlg_body,dlg_event)
              
              	
              END FUNCTION
              JOhn

              Where did this code originate from?

              It appears to be based on tables and sets that are similar to AlphaSports, but not on the generic AlphaSports.

              Without the proper tables and sets, you can't run the script.
              Al Buchholz
              Bookwood Systems, LTD
              Weekly QReportBuilder Webinars Thursday 1 pm CST

              Occam's Razor - KISS
              Normalize till it hurts - De-normalize till it works.
              Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
              When we triage a problem it is much easier to read sample systems than to read a mind.
              "Make it as simple as possible, but not simpler."
              Albert Einstein

              http://www.iadn.com/images/media/iadn_member.png

              Comment


                #67
                Re: x_Dialog Tab Stops

                Al,

                You are right. It is different and attached the new dbf files with same code.- The attachment does not work with Windows10

                Comment


                  #68
                  Re: x_Dialog Tab Stops

                  John,
                  There is no link perse. The principle that I see appears to be:-
                  Master link field is obtained here
                  Code:
                  function get_header_variables as v (vars as P)
                      with vars
                  		vInvId = tih.eval("invoice_number")
                          invoice_number = tih.eval("invoice_number")
                  Then the items should be filtered to that one way or another in the function that displays the items.
                  And it does here in init...this btw is a method I often use, but it is not from A5 samples or wizards.
                  Code:
                         browseObj1.queryrun("invoice_number="+quote(vInvhdrId))
                  and presume it is working.

                  So
                  What is it that is incorrect when you view the xdlgs produced (running the code)?
                  I think it is a stretch posting 500 lines of dense code, that cannot be tested, no working sample and for us to guess what it is that is not working.
                  The problem may even be elsewhere, like with the data.

                  If I'm not wrong,
                  I have seen many posts from you going back like a couple of years trying to get a dialog of this nature working - invoice header and transactions. Provide an adb. explain what you want and maybe we can give you an end to this.

                  Comment


                    #69
                    Re: x_Dialog Tab Stops

                    Ray,

                    I tried to load the attachment at here however A5 attachment button still not fixed yet.
                    I am not able to load the files even though the Windows Xp version computer.

                    *If I will use an xdialog(add/edit layout), I do not have this "Parent_id(Primary key)" problem.

                    My xml Browse has the "<New record>" mode, as like typical browse. I focused and entered new record, the other fields, drop down or calculation fields are fine except the "invoice_number field. The "invoice_number" field is blank so I think, The "Invoice_number" should be filled in with "parent_id" by automatic but It is not.

                    Do I have to write a expression for "invoice_number" = my_variable in some where inside xml browse?

                    Can I create an event such as "ObjectBrowse.newrecord(?)" ?

                    Comment


                      #70
                      Re: x_Dialog Tab Stops

                      I must admit that although I have read this thread several times, I still do not understand what you are trying to do. To me it sounds like you are creating the items first and then want to create the invoice header and have the records link in your xdialog form.

                      I have a routine where the user selects the items (filtered by cust id), that he wants to add to an invoice and the script copies the already existing invoice header->invoice no. to the selected items. Once the items have been updated, then I show the invoice form with parent and linked child records ready to print.
                      Robin

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

                      Comment


                        #71
                        Re: x_Dialog Tab Stops

                        All I can suggest to try add a record to the table and refresh.
                        I'm sure there is some way to do as you wish I have not done that. It would require quite some dedicated time for me to explore.
                        If something occurs I will keep you in mind.

                        Comment


                          #72
                          Re: x_Dialog Tab Stops

                          Hi

                          I have enclose the DBF Zip file.
                          Attached Files

                          Comment


                            #73
                            Re: x_Dialog Tab Stops

                            Originally posted by MoGrace View Post
                            I must admit that although I have read this thread several times, I still do not understand what you are trying to do. To me it sounds like you are creating the items first and then want to create the invoice header and have the records link in your xdialog form.
                            Robin

                            I'm with you.

                            John

                            Can you provide additional intel?
                            Al Buchholz
                            Bookwood Systems, LTD
                            Weekly QReportBuilder Webinars Thursday 1 pm CST

                            Occam's Razor - KISS
                            Normalize till it hurts - De-normalize till it works.
                            Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                            When we triage a problem it is much easier to read sample systems than to read a mind.
                            "Make it as simple as possible, but not simpler."
                            Albert Einstein

                            http://www.iadn.com/images/media/iadn_member.png

                            Comment


                              #74
                              Re: x_Dialog Tab Stops

                              I believe what John is wanting, is to click "add record" on the last line in the XML browse and add an item.
                              In doing so that item will not be attached to the invoice BECAUSE they are not linked, therefore has no master id.
                              What he wants is how to write the Master linking ID to the child record, otherwise it will not show.

                              Comment


                                #75
                                Re: x_Dialog Tab Stops

                                Originally posted by Ray in Capetown View Post
                                I believe what John is wanting, is to click "add record" on the last line in the XML browse and add an item.
                                In doing so that item will not be attached to the invoice BECAUSE they are not linked, therefore has no master id.
                                What he wants is how to write the Master linking ID to the child record, otherwise it will not show.
                                So do this.

                                1. Change the code he has to make this variable GLOBAL

                                dim GLOBAL vInvHdrId as c


                                2. Field rule for Invoice_Item->Invoice_Number

                                Default value - Var->vInvHdrId

                                checkbox
                                X - set default value at start of data entry

                                Make Invoice_Item->Invoice_Number read only.

                                field rule - events - field events - caneditfield - cancel()

                                This emulates a set that he is avoiding.

                                The question still remains of why all of this work in an xdialog rather than a form that can be opened as a dialog?

                                btw, this latest version is some what different from the image shown in previous posts where the question was how to give focus to a pop up lookup. Now it's a drop down for product.
                                Al Buchholz
                                Bookwood Systems, LTD
                                Weekly QReportBuilder Webinars Thursday 1 pm CST

                                Occam's Razor - KISS
                                Normalize till it hurts - De-normalize till it works.
                                Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                                When we triage a problem it is much easier to read sample systems than to read a mind.
                                "Make it as simple as possible, but not simpler."
                                Albert Einstein

                                http://www.iadn.com/images/media/iadn_member.png

                                Comment

                                Working...
                                X