12 Replies Latest reply on Apr 20, 2016 12:24 AM by Stigge

    Portal rows field values in loop in script..?

    Stigge

      Hi

       

      In a tab object i have a Portal, that lists Software assigned to a Computer. What i need to do now is to add these to my change log in a script.

      But i am a bit stuck..  here is what i have so far:

       

       

      Problem is now is that it uses Portal field values only from Portal record 1 and paste them in each line.. i still created each line for each record in the portal.. :/

      Am guessing there is some way around this ?

        • 1. Re: Portal rows field values in loop in script..?
          User26869

          I think it's because you never increment the $portal variable, you always go to Portal Row [select; No dialog ; 1].

           

          Chloé

          • 2. Re: Portal rows field values in loop in script..?
            Stigge

            i do at close to loop end. =)

            I used a show custom dialog to track.. and its going from 1 -> end.. just not getting the values.. :/ am guessing its the set field that are wrong.. :/

            • 3. Re: Portal rows field values in loop in script..?
              User26869

              Hum, sorry about that, I thought you were going through the portal in the inside loop, not the outside one.

              What does your debugger says?

              • 4. Re: Portal rows field values in loop in script..?
                Stigge

                My debugger is not saying anything (sitting on Pro) :/

                • 5. Re: Portal rows field values in loop in script..?
                  User26869

                  So maybe instead of going through your portal using the $portal counter, use "Go to portal row [first]" before the first Loop, and instead of Set Variable [$portal ; $portal + 1] write Go to row [Next; exit after last]

                  • 6. Re: Portal rows field values in loop in script..?
                    User26869

                    And get rid of the Go to Row in the inside loop.

                    So one loop for the rows (outside), one loop for the fields (inside).

                    • 7. Re: Portal rows field values in loop in script..?
                      Stigge

                      i see what you are going. =) already tried that one..

                      And by using the Show Custom Dialog, am printing Get(ActivePortalRawNumber) it shows that its working..

                      That one tells me "Software field" and ActivePortalRow.  but it looks like this every row:

                      Microsoft Access - 1

                      Microsoft Access - 2

                      Microsoft Access - 3

                      Microsoft Access - 4

                      Microsoft Access - 5

                       

                      It should be looking like this:

                      Microsoft Access - 1

                      Adobe Acrobat Standard - 2

                      Adobe Acrobat Pro - 3

                      Microsoft Office - 4

                      SnagIT - 5

                       

                      Same thing with using "Go to Portal Row".. :/

                      • 8. Re: Portal rows field values in loop in script..?
                        ninja

                        It looks like you start the script from the child table, then go "Home" and try to work through a portal.

                        Does it make more sense to simply run within a found set on the child table?

                         

                        Even if you were starting from the "Home" Layout, I would pop a new window, GTRR and work from the found set in the child table.  It is easier to do than to try to work through the portal.

                         

                        HTH

                        • 9. Re: Portal rows field values in loop in script..?
                          Stigge

                          Hi Eric..

                           

                          Thanks for giving it a try =)

                           

                          Home is main page..

                          Software table is the location of the data am creating logs from.

                          Log table is the where am trying to create new records in..

                          And then end up at Home again..

                           

                          So you think its better to go Home -> Software -> Logs -> Home  ?

                          You might be right,

                           

                          So basicly i do.

                          -> Home

                               -  Set the variables i need

                          -> Software

                               - Search the criterias i need

                          -> Logs

                               - Creates the tables and values i need

                          -> Home

                               -  Finnished

                           

                          That way i basicly leave the portal as it is.. Yaa you might be right.. =)

                          But the function it self then,, to grab information from inside a portal.. shouldnt that be possible ? since i already have the search and criteria ready there.

                          • 10. Re: Portal rows field values in loop in script..?
                            flybynight

                            Looks like you have some things in the wrong order.

                            You set all of your variables before you Go To Portal Row, then right after that, you go to a different layout, which will lose the focus of the portal.

                            On your inside loop, the 2nd - last times, you are going to a portal row, but you are on a different layout than the first time. Is there a portal on the Logs layout?

                             

                            You set your variables right after you Go To Object, but before your Go To Portal Row step. I think your custom dialog might be misleading you. I would assume that it would go to the first line every time you go to that object without specifying a row, so I'm not sure why that number is incrementing for you.

                             

                            Anyway, long story short (too late!), I would move your Go To Portal Row step up to just under the Go To Object step (line 32). That should produce the results you are after.

                             

                            HTH,

                            -Shawn

                            • 11. Re: Portal rows field values in loop in script..?
                              ninja

                              Looking at a couple areas:

                               

                              Lines 41-43:

                              You go to a portal row and set your focus there

                              Then you go to another layout and lose the focus you just got

                               

                              Line 53:

                              Sitting on the Logs table, you are setting a field to a value including Software::Software...and you are getting the value from the first related record....over and over.

                               

                              If you loop through the records having the values you actually want, while residing on the table where those records are, the focus changes will be easier to manage and you won't be wrestling with which related record you want to look at.

                               

                              Multiple ways to defur a feline...I just tend toward the ones that are simple and clear.  If I want a list of software, I want to be on the software table.

                              If I want the software on a single computer, I start at the computer, GTRR to the software table, and get it.

                              So much simpler (mentally for me) than trying to fight with portal row focus maintenance.

                              To a large degree...it's preference.

                              • 12. Re: Portal rows field values in loop in script..?
                                Stigge

                                Thanks guys.. ! =)

                                 

                                I have followed your advice, rewriting the code to get the information from the Software table instead.

                                As you say, simpler in the mind =D

                                 

                                Thanks...=)