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

Browse Record # Question

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

    Browse Record # Question

    Is there any way to get the values from a browse record that do not reflect the underlying table. (i.e. browse.current_record gives the same # as the table record #) If, say, I have the following code;

    current_record = tbl.recno()
    If current_record <> 1 Then
    record_data = tbl.record_data_get(current_record-1)
    target = table.open("qtduplicate")
    target.enter_begin()
    target.record_data_set(record_data)
    sw2_value = target.sw2
    target.delete()
    target.enter_end(.t.)
    target.close()

    If size->sw1 < sw2_value Then
    "do something"
    End If
    End If

    This compare the value in a field in the preceeding record to a value in the same field in the current record. All works fine until a record is deleted. There will be, say 4 records in the table, but the current_record will read 5.
    Must the table be packed everytime a record is deleted. ?

    Also, why is it that if I empty a table- pack it, under table properties it show a number for records.

    Regards p.s. what happened to the coffee mug thing. ?

    #2
    Re: Browse Record # Question

    James, I admit to not understanding your script. However the <tbl>.delete() method will automatically fetch the next record.

    If you want to check a field value in a previous record there's no need to copy the entire record to a different table in order to read it there. Why not fetch the previous record and check the field value ?

    Comment


      #3
      Re: Browse Record # Question

      Tom;

      Looks like your the only one with the patience to put up with my blithering anymore.
      Here is what I'm trying to do.
      Have a browse.
      When the user moves down to a new row a value from one of the fields in the row above is entered into one of the new rows fields.
      Conditions are.
      Cannot be the first row that is being departed from. (First row in the browse)
      The row landing on must be new (blank)
      The value being entered must be from the next row up in sequence. i.e. if the new row is # 5 then the value entering must be from row # 4.

      My first post with all the excess bagage was to avoid the deleted record problem.
      What I have come up with now is as follows; (OnRowChange)

      tbl = table.get("size")
      tblc = tbl.get_cursor()
      current_record = tbl.recno()

      If current_record <> 1 .AND. IsBlank("size->sw1") Then
      current_record = tbl.recno()
      If tblc.mode_get() <> 0 Then
      tblc.enter_end()
      End If

      tblc.fetch_goto(current_record-1)
      tbl.enter_begin()
      size->sw1 = tblc.sw2
      tbl.enter_end()

      End If

      sw1 being the field for the value in the current row and sw2 the value from the row above.
      All works until I delete a record. If I delete, say the last record, then enter a new record all the records are one number off. i.e. current_record = 5 when there are 4 records in the table. Likewise if I delete 5 records and have only 5 in the table the current record will be 10. When I pack the table after each delete the record numbers are as wanted. (Which led me to ask why when viewing table properties is there a larger number of records than are in the table.)
      Anyway, I still have'nt come up with a working solution. When I try and pack the table from a button which does the deleteing, nothing happens. No messages or anything.
      Thanks for the ear anyway.

      Comment


        #4
        Re: Browse Record # Question

        James, I'm not clear on what your goal is. At times it seems you are talking about trying to copy a field value from a previous record. At other times it seems you are talking about trying to simply number the rows consecutively. Please clarify. What is your ultimate objective?

        All works until I delete a record. If I delete, say the last record, then enter a new record all the records are one number off. i.e. current_record = 5 when there are 4 records in the table. Likewise if I delete 5 records and have only 5 in the table the current record will be 10.
        The value assigned to your variable named "current_record" comes from the <tbl>.recno() method. This returns the record number of the current record. Record numbers don't change when you delete a record. If you're expecting the succeeding records to have a record number that's one less after a preceding record is deleted you're mistaken. Record numbers don't change when you delete a record.

        Deleting a record simply removes it from display. The "deleted" record has been "marked for deletion" but not yet physically removed from the table. It still occupies space in the table, you just can't see it. The deleted record still has a record number.

        When you pack the table the records marked for deletion are physically removed. A byproduct of this is that the table is physically smaller and the succeeding (following) records have different record numbers

        Suggest you review the help file discussion of <TBL>.RECORDS_DELETED()

        Comment


          #5
          Re: Browse Record # Question

          James,
          I believe I understand what you are trying to do. Let's start with the following to see if you can use this. The following is code for a form calculated field value (calRecOrd) that when placed as a column within an embedded browse generates 'row numbers'. Start with this and see if this is a in a direction you can work with.

          Code:
          calRecOrd = iif(table.current().eof(),run_count([COLOR="red"]TableName->FieldName[/COLOR])+1,run_count([COLOR="red"]TableName->FieldName[/COLOR]))
          If not, and you have a need for a non-calculated field (table field), to hold the displayed record sequence, then it will require some xbasic scripting, which I have operating in an application that ledger's financial transactions.


          Look at the first and go from there.
          Mike W
          __________________________
          "I rebel in at least small things to express to the world that I have not completely surrendered"

          Comment

          Working...
          X