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

How to get dirtyRowsInSection row count?

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

    How to get dirtyRowsInSection row count?

    I think I need to know how many rows are in the e.repeatingSectionInfo[].dirtyRowsInSection object.

    The only row count objects in repeating section are totalRowCount and rowCount of which neither will give me the above info.

    I am trying to set two columns in my SQL database backend that track who and what time a user changed/added a row in a repeating section.

    I realize I could setup a trigger in the backend, for the date/time, but cannot get the user id and would prefer to keep all of my programming code in Alpha 5. I am trying to keep my Postgres backend just as a big bucket with nothing fancy going on in it.

    Once I get the row count, I can dimension a variable array to get the dirty rows #'s and then add my two columns to the dirtyFieldsInSection object.

    Thanks for the help.

    #2
    Re: How to get dirtyRowsInSection row count?

    Originally posted by askoog66 View Post
    I think I need to know how many rows are in the e.repeatingSectionInfo[].dirtyRowsInSection object.

    The only row count objects in repeating section are totalRowCount and rowCount of which neither will give me the above info.

    I am trying to set two columns in my SQL database backend that track who and what time a user changed/added a row in a repeating section.

    I realize I could setup a trigger in the backend, for the date/time, but cannot get the user id and would prefer to keep all of my programming code in Alpha 5. I am trying to keep my Postgres backend just as a big bucket with nothing fancy going on in it.

    Once I get the row count, I can dimension a variable array to get the dirty rows #'s and then add my two columns to the dirtyFieldsInSection object.

    Thanks for the help.

    So, you could count them manually either client-side

    Code:
    //javascript
    var repSec = {dialog.Object}.repeatingSections['REPSECID'];
    var dirty = 0;
    for (var i = 1; i <= repSec.rows; i++) {
        if ( repSec._r[0].i[i-1].dirty ) {
            dirty++;
        }
    }
    Or server-side
    Code:
    //in afterDialogValidate server-side event (xbasic)
    dim dirtyNonDeletedRowsInSection as n = line_count(e.repeatingSectionInfo[].dirtyNonDeletedRowsInSection)
    dim dirtyRowsInSection as n = line_count(e.repeatingSectionInfo[].dirtyRowsInSection)
    The dirtyNonDeletedRowsInSection appears undocumented.
    ---
    Sarah
    Alpha Anywhere latest pre-release

    Comment


      #3
      Re: How to get dirtyRowsInSection row count?

      This is what I came up with after working on all day. It doesn't work
      Code:
      dim dirtyrowcount as n
      dim rownum as n
      dirtyrowcount = line_count(e.repeatingSectionInfo[1].dirtyRowsInSection)
      FOR counter = 1 to dirtyrowcount
      	rownum = e.repeatingSectionInfo[1].dirtyRowsInSection[counter]
      	e.datasubmitted.mastermoddatetime[rownum] = now()
      	e.datasubmitted.mastermodempid[rownum] = session.userid
      	e.dirtyColumns = e.dirtyColumns + crlf() + \
      		"mastermoddatetime[" + rownum + "]" + crlf() +  \
      		"mastermodempid[" + rownum + "]"
      NEXT
      If I substitute a number for variable rownum like this...it works
      Code:
      dim dirtyrowcount as n
      dim rownum as n
      dirtyrowcount = line_count(e.repeatingSectionInfo[1].dirtyRowsInSection)
      FOR counter = 1 to dirtyrowcount
      '	rownum = e.repeatingSectionInfo[1].dirtyRowsInSection[counter]
      rownum = 3
      	e.datasubmitted.mastermoddatetime[rownum] = now()
      	e.datasubmitted.mastermodempid[rownum] = session.userid
      	e.dirtyColumns = e.dirtyColumns + crlf() + \
      		"mastermoddatetime[" + rownum + "]" + crlf() +  \
      		"mastermodempid[" + rownum + "]"
      NEXT
      Testing is being done on a repeating section with two existing rows and having a third added to it. I realize this is the most basic of testing and I will want to make sure that if rows 1,3,4 are modified, only they are so modified in the mastermoddatetime and mastermodempid columns of the repeating section.

      Thanks for looking

      Comment


        #4
        Re: How to get dirtyRowsInSection row count?

        Originally posted by askoog66 View Post
        This is what I came up with after working on all day. It doesn't work
        Code:
        dim dirtyrowcount as n
        dim rownum as n
        dirtyrowcount = line_count(e.repeatingSectionInfo[1].dirtyRowsInSection)
        FOR counter = 1 to dirtyrowcount
        	rownum = e.repeatingSectionInfo[1].dirtyRowsInSection[counter]
        	e.datasubmitted.mastermoddatetime[rownum] = now()
        	e.datasubmitted.mastermodempid[rownum] = session.userid
        	e.dirtyColumns = e.dirtyColumns + crlf() + \
        		"mastermoddatetime[" + rownum + "]" + crlf() +  \
        		"mastermodempid[" + rownum + "]"
        NEXT
        If I substitute a number for variable rownum like this...it works
        Code:
        dim dirtyrowcount as n
        dim rownum as n
        dirtyrowcount = line_count(e.repeatingSectionInfo[1].dirtyRowsInSection)
        FOR counter = 1 to dirtyrowcount
        '	rownum = e.repeatingSectionInfo[1].dirtyRowsInSection[counter]
        rownum = 3
        	e.datasubmitted.mastermoddatetime[rownum] = now()
        	e.datasubmitted.mastermodempid[rownum] = session.userid
        	e.dirtyColumns = e.dirtyColumns + crlf() + \
        		"mastermoddatetime[" + rownum + "]" + crlf() +  \
        		"mastermodempid[" + rownum + "]"
        NEXT
        Testing is being done on a repeating section with two existing rows and having a third added to it. I realize this is the most basic of testing and I will want to make sure that if rows 1,3,4 are modified, only they are so modified in the mastermoddatetime and mastermodempid columns of the repeating section.

        Thanks for looking
        e.repeatingSectionInfo[1].dirtyRowsInSection is a CRLF delimited character list. It doesn't support []. And, secondly, if it did, I believe you would get a character type back and not a number, so you'll also want to use convert_type(). Try this instead:
        Code:
        dim rownum as n
        FOR EACH row IN e.repeatingSectionInfo[1].dirtyRowsInSection
        	rownum = convert_type(row, "N")
        	e.datasubmitted.mastermoddatetime[rownum] = now()
        	e.datasubmitted.mastermodempid[rownum] = session.userid
        	e.dirtyColumns = e.dirtyColumns + crlf() + \
        		"mastermoddatetime[" + rownum + "]" + crlf() +  \
        		"mastermodempid[" + rownum + "]"
        NEXT
        You can read more about iterating through lists, as well as arrays and collections, here: http://wiki.alphasoftware.com/~alpha...ons,+and+Lists

        I find the lack of [] support for lists (and character types) to be aggravating. I always try to use operator[] only to find myself back on the wiki trying to remember how to use the FOR EACH looping mechanism.
        ---
        Sarah
        Last edited by TheSmitchell; 12-18-2013, 07:06 PM. Reason: fixing spelling errors; also fixing a code error in convert_type (missing "N"!)
        Alpha Anywhere latest pre-release

        Comment


          #5
          Re: How to get dirtyRowsInSection row count?

          Thanks Sara,

          I understand what you did which I think does the same thing I was doing, only more elegantly.

          I still cannot get it to work. There is a definite problem with the FOR EACH NEXT loop. If I comment out the FOR EACH and NEXT and substitute in:

          row=e.repeatingSectionInfo[1].dirtyRowsInSection

          everything works fine as long as I enter/change one item at a time which is to be expected because I am only setting the first line of the array. Fore some reason, your code is not going through the array. I have captured the array in another variable when I change multiple lines and the array has the multiple lines. Therefore, something with the FOR EACH NEXT loop is not working. Don't understand why, seems like pretty simple code set.

          I appreciate your continued help.

          Comment


            #6
            Re: How to get dirtyRowsInSection row count?

            Originally posted by askoog66 View Post
            Thanks Sara,

            I understand what you did which I think does the same thing I was doing, only more elegantly.

            I still cannot get it to work. There is a definite problem with the FOR EACH NEXT loop. If I comment out the FOR EACH and NEXT and substitute in:

            row=e.repeatingSectionInfo[1].dirtyRowsInSection

            everything works fine as long as I enter/change one item at a time which is to be expected because I am only setting the first line of the array. Fore some reason, your code is not going through the array. I have captured the array in another variable when I change multiple lines and the array has the multiple lines. Therefore, something with the FOR EACH NEXT loop is not working. Don't understand why, seems like pretty simple code set.

            I appreciate your continued help.
            It's entirely probably likely that my code is wrong. I'll see if I can work it out and post a real, actually tested example of looping through dirtyRowsInSection

            ---
            Sarah
            Alpha Anywhere latest pre-release

            Comment


              #7
              Re: How to get dirtyRowsInSection row count?

              Originally posted by askoog66 View Post
              Thanks Sara,

              I understand what you did which I think does the same thing I was doing, only more elegantly.

              I still cannot get it to work. There is a definite problem with the FOR EACH NEXT loop. If I comment out the FOR EACH and NEXT and substitute in:

              row=e.repeatingSectionInfo[1].dirtyRowsInSection

              everything works fine as long as I enter/change one item at a time which is to be expected because I am only setting the first line of the array. Fore some reason, your code is not going through the array. I have captured the array in another variable when I change multiple lines and the array has the multiple lines. Therefore, something with the FOR EACH NEXT loop is not working. Don't understand why, seems like pretty simple code set.

              I appreciate your continued help.
              Ha ha ha. I forgot that to access the data in x in your FOR EACH x IN y you have to use .value:

              Code:
              dim rownum as n
              FOR EACH row IN e.repeatingSectionInfo[1].dirtyRowsInSection
              	rownum = convert_type([COLOR="#FF0000"][B]row.value[/B][/COLOR], "N")
              	e.datasubmitted.mastermoddatetime[rownum] = now()
              	e.datasubmitted.mastermodempid[rownum] = session.userid
              	e.dirtyColumns = e.dirtyColumns + crlf() + \
              		"mastermoddatetime[" + rownum + "]" + crlf() +  \
              		"mastermodempid[" + rownum + "]"
              NEXT
              This is the demo I wrote to debug:

              Code:
              function afterDialogValidate as v (e as p)
              
              	'demo loop
              	debug(1)
              	dim js as c = ""
              	dim msg as c = ""
              	for each row in e.repeatingSectionInfo[1].dirtyRowsInSection
              		dim rowNum as n = convert_type(row.value,"N")
              		msg = msg + rowNum + ","	
              	next
              	
              	js = "alert('" + js_escape(msg) + "');"
              	e.javascript = js
              
              end function
              Alpha Anywhere latest pre-release

              Comment


                #8
                Re: How to get dirtyRowsInSection row count?

                Thank you Sara.....sorry for the delay between snowplowing and my mis-typed variable causing headaches.

                This is what I ended up with

                Code:
                dim rownum as n
                FOR EACH row in e.repeatingSectionInfo[1].dirtyRowsInSection
                	rownum = convert_type(row.value, "N")
                	e.datasubmitted.addrmoddatetime[rownum] = now()
                	e.datasubmitted.addrmodempid[rownum] = session.userid
                	e.dirtyColumns=e.dirtyColumns + crlf() + \
                		"addrmoddatetime[" + rownum + "]" + crlf() +\
                		"addrmodempid[" + rownum + "]"
                Just as an aside for someone who may find this discussion....the above code will have to be duplicated for each repeating section. Also, you have to make sure you change the appropriate variables for each control in the repeating section. Also make sure you change the number in the e.RepeatingSectionInfo[] object.

                Comment


                  #9
                  Re: How to get dirtyRowsInSection row count?

                  Originally posted by askoog66 View Post
                  Thank you Sara.....sorry for the delay between snowplowing and my mis-typed variable causing headaches.

                  This is what I ended up with

                  Code:
                  dim rownum as n
                  FOR EACH row in e.repeatingSectionInfo[1].dirtyRowsInSection
                  	rownum = convert_type(row.value, "N")
                  	e.datasubmitted.addrmoddatetime[rownum] = now()
                  	e.datasubmitted.addrmodempid[rownum] = session.userid
                  	e.dirtyColumns=e.dirtyColumns + crlf() + \
                  		"addrmoddatetime[" + rownum + "]" + crlf() +\
                  		"addrmodempid[" + rownum + "]"
                  Just as an aside for someone who may find this discussion....the above code will have to be duplicated for each repeating section. Also, you have to make sure you change the appropriate variables for each control in the repeating section. Also make sure you change the number in the e.RepeatingSectionInfo[] object.
                  Congrats on getting some working code! :D

                  Sorry you got more snow. We have snow, but the kind that fell a month ago and is just now seeing the light of day. 50s this weekend... DIE, SNOW! DIE!
                  Alpha Anywhere latest pre-release

                  Comment

                  Working...
                  X