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

Form.ViewLinked()?

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

    Form.ViewLinked()?

    Hi Guys,

    I cant get Form.Viewlinked() to work as expected. Help file says selected fields are filled when a new record is created, but I cant get this to happen.

    Here is the code I have used in Alphasports.

    Code:
    dim linkdef as c
    linkdef = "invoice_number ="+s_quote(Invoice2.value)
    dim p as p
    p=form.ViewLinked("Invoice_Items",linkdef,"","","dialog_newrecord")
    P.close()
    This is on a button to open a form named Invoice_Items. It will only add a new item if there is child record already there.

    I was hoping that Form.Viewlinked() would work the same way as clicking into the browse to enter a new child record.

    Also I have found that the form must be based on the child table and not the set as all sorts of strange things happen.

    So I'm at the stage of, is it me or ????????????????
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    #2
    Re: Form.ViewLinked()?

    Works for me Keith, have you defined the form Invoice_items"?

    Comment


      #3
      Re: Form.ViewLinked()?

      Why isn't this method (FoRM.VIEWLINKED) included in the vers 9 INDEX to the HELP file?

      Why can't SEARCH in the HELP file find this method?

      -- tom

      Comment


        #4
        Re: Form.ViewLinked()?

        Tell me about it Tom! The quality of the help file since version 7 has been atrocious

        Comment


          #5
          Re: Form.ViewLinked()?

          Keith, I didn't think Form.viewlinked added any new records by itself. Is that what you're expecting? I thought it merely supplied the necessary link field value when some other process enters a new record through the form that is opened... am I missing something?

          Comment


            #6
            Re: Form.ViewLinked()?

            Tom/Keith,

            The form.viewlinked() method optional style argument when set to dialod_newrecord as in Keith's example does start entering a new record as soon as it is run and this record is committed by any of the traditional methods (F9, save button on form, page down to next new record etc).

            this is from the what's new in version 8 information
            Form.ViewLinked() Method - This new method is similar to the .ViewQueried() method in that it opens a form showing selected records. However, with the .ViewLinked() method, you can specify how the target form (i.e. the form that is opened by this method) is linked to a parent table, and Alpha Five will automatically ensure that the correct values are entered into the linking fields when a record is edited or created, ensuring that the records edited/created in the target form remain properly linked to their 'parent' record.

            P formPointer = Form.ViewLinked (C LayoutName , C LinkDefinition [, C filter_expn [, C order_expn [, C style [, C x_position [, C y_position [, OtherOptions ]]]]]])
            OtherOptions.Restrict_Navigation = .f.

            Where:
            formPointer A pointer to the form that is opened.
            LayoutName The name of the form to open. This is called the 'target' form.
            LinkDefinition A CR-LF delimited list of link conditions in the form of: linkTableField = linkValue
            e.g.
            firstname = "john"
            lastname = "smith"

            Filter_expn An optional filter to apply (in addition to the filter implied by the LinkDefinition) when the target form is opened. For example using the sample LinkDefinition shown above, the target form is automatically filtered using
            firstname = "john" .and. lastname = "smith"
            If you only wanted to see records for John Smith where the transaction date was in January, you might specify a filter_expn of:
            month(transactionDate) = 1

            Order_expn An optional order expression.
            Style The style in which the target form should be opened. Options are: null - open as a regular modeless form, 'dialog' - open as a modal form, 'dialog_newrecord' - open as a modal form showing a new record, 'hidden' - hidden until the .show() method is called on the form pointer, 'hidden-dialog' - hidden until the .show() method is executed on form pointer (or some other method that causes the form to become visible, such as .new_record() is called). Default value is null.
            X_Position Left, Center, Right, Fill or an absolute position expressed in pixels. Default value is null, which uses the definition stored in the form layout.
            Y_Position Top, Center, Bottom, Fill, or an absolute position expressed in pixels. Default value is null, which uses the definition stored in the form layout.
            OtherOptions A dot variable. Currently supports a single property. OtherOptions.Restrict_Navigation. Indicates if navigation from record to record is allowed when the target form is opened. Typically, when the user is viewing the last record in a query and he/she navigates to the 'next' record, Alpha Five displays a new record. If you want to prevent the user from navigating to a new record, set this property to .t.

            Example:
            The following command opens the 'InvoiceItems' form and ensures that any records either edited or added are automatically linked to the correct parent record (which has an InvoiceNumber of 'INV1234'). Assume for demonstration purposes that the InvoiceNumber field in the target table (i.e. the table on which the target form is based) is called 'InvNum' (and not 'InvoiceNumber' as it might be called in the parent record).

            dim LinkDef as c
            LinkDef = "InvNum = \"INV1234\""
            dim p as p
            p = Form.ViewLinked("InvoiceItems",LinkDef)

            Comment


              #7
              Re: Form.ViewLinked()?

              Thanks, Lance.

              Keith, maybe you should try using the method without the "dialog_newrecord" parameter, then have your script begin the new record.

              Comment


                #8
                Re: Form.ViewLinked()?

                Hi Tom and Lance,
                Alpha Five will automatically ensure that the correct values are entered into the linking fields when a record is edited or created
                It does not seem to matter what the style is, if there are no child record/s, opening the child form does not populate with the linking value.
                Regards
                Keith Hubert
                Alpha Guild Member
                London.
                KHDB Management Systems
                Skype = keith.hubert


                For your day-to-day Needs, you Need an Alpha Database!

                Comment


                  #9
                  Re: Form.ViewLinked()?

                  No other takers so do I report this as a you know what?
                  Regards
                  Keith Hubert
                  Alpha Guild Member
                  London.
                  KHDB Management Systems
                  Skype = keith.hubert


                  For your day-to-day Needs, you Need an Alpha Database!

                  Comment


                    #10
                    Re: Form.ViewLinked()?

                    Keith, I don't use it and haven't had the time to build a model from scratch for testing... If you are asking someone to confirm the behavior you're seeing how about posting a model we can test on our machines? -- tom

                    Comment


                      #11
                      Re: Form.ViewLinked()?

                      Hi Tom,

                      The form "Invoice_Items" is from the default form of the Invoice Items table. This form will not open if you build the form on the Invoice set.

                      The code: dim linkdef as c
                      linkdef = "invoice_number ="+s_quote(Invoice2.value)
                      dim p as p
                      p=form.ViewLinked("Invoice_Items",linkdef,"","","dialog_newrecord")
                      P.close()

                      the code is on a button on the Invoice form.

                      Thats it.

                      Press the button on the first invoice and the child form opens with the link field filled, and waiting for the other fields to be filled. Now enter a new invoice, press the button and the link field is not filled. Even if the parent is saved, the link field does not get populated. Once a child record has been entered through the browse then the form.viewlinked() function fills the child link field.

                      As I have asked have I got this wrong, or is it a B...........?
                      Regards
                      Keith Hubert
                      Alpha Guild Member
                      London.
                      KHDB Management Systems
                      Skype = keith.hubert


                      For your day-to-day Needs, you Need an Alpha Database!

                      Comment


                        #12
                        Re: Form.ViewLinked()?

                        Hi Keith

                        I can confirm what you see. No I don't think there is something wrong with what you are doing. I tried it in v8 and it works fine( a new record is created if there are no existing child records). And I just tried in an older version of v9 (1869 - 3218, pre new browse) and it also works.

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

                        Comment


                          #13
                          Re: Form.ViewLinked()?

                          I am using 2095 - 3264, with a new invoice (header saved), pressing the button as described by Keith does not populate the link field visibly until the record is committed.

                          I don't feel this is a bad thing, in truth do you want to show the linking field on the child form? It is not shown in the browse, and if visible on the form is open to abuse by unsuspecting operatives unless disabled or made read-only which makes it a point of reference only, that is confirmed by the record being saved and the browse updating with the new record added.

                          Comment


                            #14
                            Re: Form.ViewLinked()?

                            Hi Tim,

                            Thanks for the confirmation. Had not thought of testing in V8
                            Yes it does work as stated in V8 but not V9.
                            Will now send in Bug report.
                            Regards
                            Keith Hubert
                            Alpha Guild Member
                            London.
                            KHDB Management Systems
                            Skype = keith.hubert


                            For your day-to-day Needs, you Need an Alpha Database!

                            Comment


                              #15
                              Re: Form.ViewLinked()?

                              But Lance,
                              I don't feel this is a bad thing
                              what about developers who use such a function in prior versions or builds? If Alpha changed the way the function worked it would break their scripts (although very doubtful there have many or even any developers who have yet). And how is this different from how any link is viewed or not viewed currently??---most developers do not show it even if it has to be present it seems...I wouldn't/don't.
                              Mike
                              __________________________________________
                              It is only when we forget all our learning that we begin to know.
                              It's not what you look at that matters, it's what you see.
                              Henry David Thoreau
                              __________________________________________



                              Comment

                              Working...
                              X