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

table change begin

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

    table change begin

    ill explain my set up first,

    parent table - casefile. child table - Track.

    in track a record is added called 'File Check' (this is done auto and only one file check can exist per parent)

    here is the code to add the file check (may help with my question). this action is fired if certain fields are not completed (they may be completed later but must be completed before the record is considered complete)
    Code:
    dim tbl as P
    dim vcref as c
    dim vclient as c
    
    tbl = table.open("track")
    
    tbl.enter_begin(.T.)
    tbl.Task_user=casefile->Adviser
    tbl.Task_by="Compliance"
    tbl.Task_due=date()
    tbl.Task_group="File Check"
    tbl.Caseref=casefile->caseref
    tbl.Ask_client=calc->cclient1
    tbl.enter_end(.T.)
    
    tbl.close()
    when the fields that were previously not complete are now completed i need to update the record to show as done. I was going to build a form, filter the record, mark the relevant field as .T. then close the form, but this is messy.

    the problem i am having is just the filter, i need to filter caseref (this will be on the parent and child table as the linking field) and the record in track which has the words 'file check' for this particular parent record.

    here is my attempt at the code so far.

    Code:
    dim tbl as P
    dim track as c
    dim caseref as c
    
    
    tbl = table.open("track")
    
    tbl.change_begin(.T.)
    track= "tbl.Task_group="File Check""
    caseref = casefile->caseref [COLOR="Red"]or could be 
    track->caseref[/COLOR]
    query.filter ="("+track+") .and. ("+caseref +")"
    tbl.Task_done=.t.
    tbl.change_end(.T.)
    
    tbl.close()
    its not working for me, i have tried a few things before posting.

    #2
    Re: table change begin

    Originally posted by richard2007 View Post
    the problem i am having is just the filter, i need to filter caseref (this will be on the parent and child table as the linking field) and the record in track which has the words 'file check' for this particular parent record.

    here is my attempt at the code so far.

    Code:
    dim tbl as P
    dim track as c
    dim caseref as c
     
     
    tbl = table.open("track")
     
    tbl.change_begin(.T.)
    track= "tbl.Task_group="File Check""
    caseref = casefile->caseref [COLOR=red]or could be [/COLOR]
    [COLOR=red]track->caseref[/COLOR]
    query.filter ="("+track+") .and. ("+caseref +")"
    tbl.Task_done=.t.
    tbl.change_end(.T.)
     
    tbl.close()
    its not working for me, i have tried a few things before posting.
    If Task_group is already filled in as "File Check" and the only field that needs to be changed is Task_done then why not use a post field rule? Your Casefile table needs a field matching Task_done so that when it is changed it posts to the Track table matching Caseref to Caseref. When you initially add the Track record with your first script set its value to .f. Then when the Casefile record is complete your post will update the Track table for you. Which now makes me wonder why you need the Track record at all!
    Last edited by MoGrace; 05-21-2008, 02:12 PM.
    Robin

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

    Comment


      #3
      Re: table change begin

      robin,

      track holds lots of other records for the client (parent record) (its similar to a task system). so file check is only one of the records that can be added, but only one file check will be added for each parent.

      this is where my problem is, filtering the child records in Track, to no only filter to the current parent record, but find the only record where task_group has a value of 'file check'.

      Comment


        #4
        Re: table change begin

        Richard, it sounds to me as though the user is working in a form based on the set in question and you are running these xbasic routines while they are working on that form. If so, using the table.OPEN() command is probably counter productive. (There are so many possible variations when setting up something like this that I'm not likely to say anything is an absolute.) It makes screen refreshes more difficult and forces you to do things like use filters or indexes when there may be a better way.

        If your current form already uses the set in question. (I presume it does.) It will probably be more effective to use either table.get() or something like:
        tpl = parentform:tables:track.this

        Either of these will get you a pointer to the current session of the table.

        - If you were already in the correct record in the child table, a search wouldn't be necessary because you are already there and your table pointer will already be pointing to the correct record.

        - If you need to add a new record, you can do that and easily update the form to show the new record with a simple parentform.refresh_layout().

        - If you are not in the correct child record, the pointer to the child table will already be filtered to show only those that are linked to the current parent record and a .fetch_first() followed by a loop with .fetch_next() to find the specific record usually works.

        - If you want to change a child record that is not linked to the current parent record (not sure why you would do that), then the .open() command is probably the best way to do it.

        There are some nuances you will have to get used to when using these methods but, after beating my head against the wall for many years, I finally started to use these methods and they have made my life much simpler overall. The "how do I find this" and, especially, the "how do I refresh the form now" issues basically go away. Using the .open() method then trying to resynch and refresh the form nearly drove me to the loony bin.

        Also, you said, "this action is fired..." My question is, "When?" It can make a big difference if it's when the form initially loads, when a new record is created, when a specific field is written to, when a specific field is exited, when the parent record is saved, when changing to a different child record, etc. Saying "this action is fired" is kinda like calling your friendly local mechanic on the phone and saying "My car doesn't work. What's wrong with it?" He can give you an answer if you really want one - but there's a good chance his answer won't have anything to do with your problem.
        Last edited by CALocklin; 05-24-2008, 02:57 PM.

        Comment


          #5
          Re: table change begin

          In addition to the good advice already given a couple of ideas on your code.

          The code is sort of inside out. You need to set the filter and run the query to find the correct record before you initiate the change begin. You have attempted to define the filter but you have not actually queried the table using the filter.

          Cal has already given some suggestions if the task table was involved with the form currently open. However if not (ie even though the task table has records related to the current caseref record but you are not involving the task table in the current user activity) then table.open() would be fine and the code would look something like
          Code:
          dim tc as P 
          dim tbl as P
          
          tc = table.current()
          tbl = table.open("track")
          
          query.filter = "Caseref=" + quote(tc.caseref) + ".AND. alltrim(Task_group)='File Check'"
          query.order = ""
          query.options  = ""
          
          qry = tbl.query_create()
          nrecs = qry.records_get()
          
          IF nrecs = 1 then
              tbl.change_begin()
              tbl.Task_done=.t.
              tbl.change_end(.T.)
          End if
          
          qry.drop()
          query.filter = ""
          query.order = ""
          query.options  = ""
          
          tbl.close()
          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


            #6
            Re: table change begin

            Cal, Tim,

            great big help, thanks. (replies such as these not only give the answer but help with understanding as well)

            yes, the form is based upon a set with the parent and child.
            the child record i wish to edit is based upon the current record open in the form
            the event is fired after the user exits a field (a date field and only if the date field is not blank).

            cal, i take your comments on board re when the event is fired. it must be frustrating for those trying to help us newer users.

            ill work with this and post back how i get on.

            richard

            Comment


              #7
              Re: table change begin

              Hi Tim,

              finaly got round to this and it worked perfectly. i had some other areas for this, (such as closing all outstanding tasks if a case gets cancelled mid process).

              thanks you

              richard

              Comment

              Working...
              X