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

Adding repeating rows via XBASIC

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

    #16
    Re: Adding repeating rows via XBASIC

    Jinx,

    I'm uploading a ZIP of a sample project, including a test access file.

    The UX is ux_main

    First button populates data of an existing record.

    Second button ("add rows") is the issue. It calls an ajax function (getTemplateData) but it does not populate the repeating section. Its job is to look at the TEMPLATES table in the database, look for all rows that are templateid = 1 (currently 2 rows) and fill in those defaults to the repeating section.

    I'm just so stuck here. Thank you!!

    Here is the file: DemoMobileApp.zip

    Comment


      #17
      Re: Adding repeating rows via XBASIC

      I'm checking it out. I haven't done it the way you're doing it before. I've always used something like the code above. I'll give it a try though. For starters, you aren't getting any results with the query, so the pjs is empty, and that's why it isn't putting anything in your repeating sections.

      Comment


        #18
        Re: Adding repeating rows via XBASIC

        I should say instead, that pJs is empty but the query itself is working.

        Comment


          #19
          Re: Adding repeating rows via XBASIC

          OK,
          Here's the code to make your example work....MY way...LOL You have to replace the text in cn.Open to be your connection string (cn.open("::Name::dbConn") if that's what it is) as opposed to my adhoc one to the tables you sent.

          Code:
          function getTemplateData as C (e as p)
          dim jscmd as c
          dim j as p
          dim cn as SQL::Connection
          
          cn.Open("{A5API='Access',A5Syntax='Access',FileName='C:\Users\adherr\Desktop\DemoMobileApp\testdb1.accdb',UserName='Admin'}")
          
          dim sqlCommand as C = "SELECT * FROM templates WHERE templateid = 1"
          dim cnt as n = 0
          
          	if cn.Execute(sqlCommand) then
          		dim rs as SQL::ResultSet
          		rs = cn.ResultSet
          			while rs.nextrow()
          				cnt = cnt + 1
          				eval("j.BOX1_A5INSTANCE" + alltrim(str(cnt))) = rs.Data(1)
          				eval("j.BOX2_A5INSTANCE" + alltrim(str(cnt))) = rs.Data(2)
          			end while
          		jscmd = "{dialog.object}._setRepeatingSectionRowCount('CONTAINER_1'," + cnt + ",true,true);"
          		jscmd = jscmd + "{dialog.object}.populate(" + varToJSON(j) + ",1,false,true);"
          	else
          		jscmd = "alert('Execute Error: Error returned was: " + js_escape(cn.CallResult.text) + "');"
          		
          	end if
          
          debug(1)
          getTemplateData = jscmd
          
          
          
          
          end function
          You can also replace rs.Data(1) or rs.Data(2) with rs.Data("fieldname1") and rs.Data("fieldname2") but I didn't know the field names since I didn't want to create a new connection string and I couldn't "adhoc" my way into them....IOW, I was just lazy.

          P.S. I forgot but for "best practices" you should probably add cn.Close() after the end if.

          P.P.S Proof! http://screencast.com/t/ItVxxP6Scu
          Attached Files
          Last edited by -Jinx-; 02-25-2014, 03:23 PM.

          Comment


            #20
            Re: Adding repeating rows via XBASIC

            I'll give this a shot shortly. Thank you soooo much and for being so quick!!!

            Comment


              #21
              Re: Adding repeating rows via XBASIC

              And just to add a little bit more... especially if you're looking at the dialog helper functions. The solution presented in the D57 video doesn't really do what you want since you really want to work only with repeating section data. The dialog helpers assist in building the full dialog with all related data from the top down... I couldn't work out how your could use them to build just repeating section data.

              Anyway... there were a couple of key issues in your code... in case anyone needs to actually build full dialog data... here are those issues...

              http://www.youtube.com/watch?v=ITbGHV2GNzw

              Comment


                #22
                Re: Adding repeating rows via XBASIC

                Gotcha David, thank you... I did even try the 2 section approach, but it still wasn't working... I'll work through Jinx's code.

                I appreciate everyone's assistance on this. I really wish I knew as much as you all did... maybe eventually. Thank you again, it is really really appreciated!!!

                Comment


                  #23
                  Re: Adding repeating rows via XBASIC

                  Jinx, thank you again for doing the sample. I'd really like the opportunity to throw a monkey wrench in this.

                  I have two dropdown boxes, and the second one is set to cascading based on first one.

                  The values are being passed properly, dropdown 1 works, but dropdown 2 does not.

                  Would a video help to show what I mean or is that enough description?

                  Thank you
                  Chris
                  Last edited by pettechservices; 02-25-2014, 11:08 PM.

                  Comment


                    #24
                    Re: Adding repeating rows via XBASIC

                    So, did you get your actual dialog to work (besides the second drop down) using a variation of my code from the sample? What about the second drop down doesn't work? The values from the Ajax callback are or are not being populated into the dialog? I'm assuming both drop downs are in a repeating section? Does the second drop down need to be cascading or can you make it have the effect of cascading by putting a filter on the choices?

                    Yeah, a video would really help.

                    For tonight though, I'm tired and I've got a date with some warm blankets. (I'm so sick of -20F)

                    Comment


                      #25
                      Re: Adding repeating rows via XBASIC

                      Yes, it is working fine, as I did not know to use the A5INSTANCE at the end of the field names... I think I would have solved this more easily had I known that LOL.

                      The second dropdown is locked basically because it is a cascade dependent upon the first. If I remove the cascade option, then it works perfectly fine.

                      I'm going to try to figure out how to put a filter on it based on the choices in the first dropdown, instead of the cascade. Just not sure how to do that yet (hardcoded, I could, but soft-coded based on field I am not sure yet).

                      Hope your date was great, mine was! lol We aren't that cold (a friend of mine lives out by Joliet out there, and is always telling me how cold it is... In Jersey, we are around 20-30F now, but some snow this morning:)

                      Thank you again!

                      Comment


                        #26
                        Re: Adding repeating rows via XBASIC

                        I haven't gotten into cascading dropdowns in quite a while because the ones I did try always gave me trouble. You could try to refresh the choices in the dropdown box and see if it works?

                        {dialog.object}.refreshDropdownBoxChoices('fieldname')//check out this method in your builder as there are other options to input into the method.

                        just make a new button and stick the code in there to try the method to see if it works after you populate your dialog. If it does, you can add that code (possibly with a SetTimeout) to the code that jscmd sends back to the dialog.

                        You can see these videos for more info:
                        http://www.ajaxvideotutorials.com/V1...nbox_part1.swf
                        http://www.ajaxvideotutorials.com/V1...nbox_part2.swf

                        Comment


                          #27
                          Re: Adding repeating rows via XBASIC

                          Very good, thank you again! Will give this a shot today as time permits and reprot back! ! THANK YOU!

                          Comment


                            #28
                            Re: Adding repeating rows via XBASIC

                            So I finally decided to start implementing this into the larger dialog that I have (rather than my small test case) and I am left with nothing ending up in the javascript variable after the pjs = a5DialogHelper_JS_populateDialog(p) when I call the showvar(pjs.setRepeatingSections + crlf(2) + px.javascriptSetActiveRow + crlf(2) + pjs.populateControls) method I end up with just information about the repeating sections and none of the "_d" information, my best guess as I know the query part is working (px = a5DialogHelper_GetDataToPopulateDialog(sections) and showvarscript(px) show the correct data coming out of the tables), is that I am calling too much data out and the a5DialogHelper_JS_populateDialog function can't handle it (by too much I mean that I have seven defined sections), is this a possibility or am I possible missing something else? I went ahead and embedded the code below incase someone can find a syntax error somewhere (other than fields names as obviously you won't know if there is an error there).


                            Also I attempted to delete all of the sections but the first one and see if it would work and it still wasn't showing anything, so this makes me feel like its not the number of sections causing the issue.

                            Code:
                            function populateDataManually as c (e as p)
                            dim t_id as n
                            
                            t_id = e.dataSubmitted.trip_loader
                            
                            dim sections[7] as p
                            
                            sections[1].alias = "tripsheets"
                            sections[1].sql = "select * from tripsheets"
                            sections[1].filter = "ID = " + t_id
                            sections[1].order = ""
                            sections[1].connectionString = "::name::eTruck"
                            sections[1].portableSQL = .t.
                            sections[1].argumentsXML = ""
                            sections[1].fieldToVariableMap = <<%txt%
                            company_id = company_id_tripsheets
                            IdOwner = IdOwner
                            saved_trip_name = load_name
                            IdNumberOwnerEntered = CustomerTripId
                            DispatchDate = PickUpDate
                            UnitNumber = truck
                            truckId = trucks
                            TrailerNumber = trailer
                            trailerId = trailers
                            %txt%
                            sections[1].displayFormatMap = ""
                            
                            sections[2].alias = "trip_driver"
                            sections[2].repeatingSectionId = "CONTAINER_37"
                            sections[2].currentRow = 1
                            sections[2].sql = "select * from trip_driver"
                            sections[2].filter = ""
                            sections[2].order = ""
                            sections[2].connectionString = "::name::eTruck"
                            sections[2].portableSQL = .t.
                            sections[2].parentAlias = "tripsheets"
                            sections[2].parentLinkFields = "ID"
                            sections[2].childLinkFields = "trip_id"
                            sections[2].argumentsXML = ""
                            sections[2].fieldToVariableMap = <<%txt%
                            first_name = driver_first
                            last_name = driver_last
                            pmt_method = pay_method
                            user_id = user_id
                            rate_flat_fee = default_flat_fee
                            rate_per_mile_loaded = default_per_mile_loaded
                            rate_per_mile_empty = default_per_mile_empty
                            load_pay_percent = default_pct_fee
                            %txt%
                            sections[2].displayFormatMap = ""
                            'debug(1)
                            
                            
                            sections[3].alias = "trip_customers"
                            sections[3].repeatingSectionId = "CUSTOMER"
                            sections[3].currentRow = 1
                            sections[3].sql = "select * from trip_customers"
                            sections[3].filter = ""
                            sections[3].order = ""
                            sections[3].connectionString = "::name::eTruck"
                            sections[3].portableSQL = .t.
                            sections[3].parentAlias = "tripsheets"
                            sections[3].parentLinkFields = "ID"
                            sections[3].childLinkFields = "trip_id"
                            sections[3].argumentsXML = ""
                            sections[3].fieldToVariableMap = <<%txt%
                            customer_id = customer_id
                            %txt%
                            sections[3].displayFormatMap = ""
                            
                            sections[4].alias = "trip_shippers"
                            sections[4].repeatingSectionId = "SHIPPERS"
                            sections[4].currentRow = 1
                            sections[4].sql = "select * from trip_shippers"
                            sections[4].filter = ""
                            sections[4].order = ""
                            sections[4].connectionString = "::name::eTruck"
                            sections[4].portableSQL = .t.
                            sections[4].parentAlias = "tripsheets"
                            sections[4].parentLinkFields = "ID"
                            sections[4].childLinkFields = "trip_id"
                            sections[4].argumentsXML = ""
                            sections[4].fieldToVariableMap = <<%txt%
                            shipper_id = shipper_id
                            date = shipper_date
                            earliest_arrive = shipper_arrive_time
                            latest_arrive = shipper_depart_time
                            weight = shipper_weight
                            %txt%
                            sections[4].displayFormatMap = ""
                            
                            sections[5].alias = "trip_receivers"
                            sections[5].repeatingSectionId = "CONTAINER_30"
                            sections[5].currentRow = 1
                            sections[5].sql = "select * from trip_receivers"
                            sections[5].filter = ""
                            sections[5].order = ""
                            sections[5].connectionString = "::name::eTruck"
                            sections[5].portableSQL = .t.
                            sections[5].parentAlias = "tripsheets"
                            sections[5].parentLinkFields = "ID"
                            sections[5].childLinkFields = "trip_id"
                            sections[5].argumentsXML = ""
                            sections[5].fieldToVariableMap = <<%txt%
                            receiver_id = receiver_id
                            date = receiver_date
                            earliest_arrive = receiver_arrive_time
                            latest_arrive = receiver_depart_time
                            weight = reciever_weight
                            %txt%
                            sections[5].displayFormatMap = ""
                            
                            sections[6].alias = "trip_receivers"
                            sections[6].repeatingSectionId = "CONTAINER_17"
                            sections[6].currentRow = 1
                            sections[6].sql = "select * from trip_receivers"
                            sections[6].filter = ""
                            sections[6].order = ""
                            sections[6].connectionString = "::name::eTruck"
                            sections[6].portableSQL = .t.
                            sections[6].parentAlias = "tripsheets"
                            sections[6].parentLinkFields = "ID"
                            sections[6].childLinkFields = "trip_id"
                            sections[6].argumentsXML = ""
                            sections[6].fieldToVariableMap = <<%txt%
                            stop_order_num = stop_order
                            stopType = Empty_or_loaded
                            stopNotes = stopNotes
                            miles = odometer
                            stop_company_id = StopCompanyID
                            %txt%
                            sections[6].displayFormatMap = ""
                            
                            sections[7].alias = "tt_miles_per_state_states"
                            sections[7].repeatingSectionId = "CONTAINER_15"
                            sections[7].currentRow = 1
                            sections[7].sql = "select * from tt_miles_per_state"
                            sections[7].filter = ""
                            sections[7].order = ""
                            sections[7].connectionString = "::name::eTruck"
                            sections[7].portableSQL = .t.
                            sections[7].parentAlias = "tripsheets"
                            sections[7].parentLinkFields = "ID"
                            sections[7].childLinkFields = "trip_id"
                            sections[7].argumentsXML = ""
                            sections[7].fieldToVariableMap = <<%txt%
                            state_driven = State_Driven
                            miles_driven = Miles_Driven
                            adjustment_miles_loaded = Adjustment_Miles
                            adjustment_miles_empty = Adjustment_Miles_Empty
                            toll_miles = Toll_Miles
                            %txt%
                            sections[7].displayFormatMap = ""
                            
                            px = a5DialogHelper_GetDataToPopulateDialog(sections)
                            
                            
                            
                            'showvarscript(px)
                            
                            if px.haserror = .f.
                            	dim p as p
                            	result = evaluate_template(px.xbasic)
                            	dim pjs as p
                            	pjs = a5DialogHelper_JS_populateDialog(p)
                            	
                            	dim js as c = ""
                            	'showvar(pjs.setRepeatingSections + crlf(2) + px.javascriptSetActiveRow + crlf(2) + pjs.populateControls)
                            	js = js + pjs.setRepeatingSections + crlf()
                            	js = js + "var _d = {};" + crlf()
                            	js = js + pjs.populateControls + crlf()
                            	js = js + "{dialog.object}.populate(_d);" + crlf()
                            	js = js + "{dialog.object}.runAction('get child data');"
                            else
                            	ui_msg_box("","error")
                            end if
                            	
                            	
                            populateDataManually = js
                            
                            'populateDataManually = "javascript commands to be executed in the Browser."
                            end function
                            Last edited by lilmofo812; 07-21-2014, 07:20 PM. Reason: Added information about what I've tried

                            Comment

                            Working...
                            X