2 Replies Latest reply on Oct 14, 2014 2:25 PM by JackAragon

    Setting layout with variable?

    JackAragon

      Title

      Setting layout with variable?

      Post

      Hello again.

      I have multiple PO layouts with corresponding price layouts. Every PO layout has a "pricelistName" field that contains the name of the price list layout. I'm setting up a script to go from the portal on the PO layout to the related record on the price list (to make any changes to that record).

      1. I'm not allowing changes in the portal to lessen the chance of accidentally changing the price of something.

      2. I'm using a script instead of the standard "Go To Related Record" because I have a "Back" button in the price lists so the user can go right back to the PO they were working on.

      The script sets a global variable containing the layout and the back button sends you back to it. But I would also like to grab the "pricelistName" value using the

       

      What I have:

      Set Variable [$$tableName; Value:Get (LayoutName)]

      Set Variable [$priceList; Value:Gator Cases PO::pricelistName]

      Go to Related Record [From table: "Gator Cases pricing"; Using layout: "Gator Cases pricing" (Gator Cases pricing)]

      I would like to replace the "Gator Cases PO" to the value from $$tableName and the "Gator Cases pricing" to $priceList so I can have one script instead of a bunch.

      I tried:

      Set Variable [$priceList;Value:$$tableName::pricelistName]

      and got an error; presumably because I don't have the variable formatted correctly or because you just can't do that kind of thing.

      It's also entirely possible I'm over-thinking this.

      If this has been covered elsewhere, I cannot find it. Feel free to send me a link or tell me what to search for.

      Thanks in advance.

       

      -Ian

        • 1. Re: Setting layout with variable?
          philmodjunk

          Set Variable [$priceList;Value:GetField ( $$tableName & "::pricelistName" ) ]

          But your overall design description sounds very problematic.

          Layout names are not necessarily table names nor Tutorial: What are Table Occurrences? names. And it's possible for a layout, a table occurrence and a table to each have a different name and yet all reference the same table of records.

          • 2. Re: Setting layout with variable?
            JackAragon

            PhilModJunk,

            Thank you. I thought it would be something like that.

            Yes, it's not the most elegant of solutions. I know I'm going to have to be really careful about naming and table occurrences.

            This is my first time putting something like this together, and as I move forward I find cleaner and more flexible ways to do things.

            I really appreciate your help and the speed with which you do it.

             

            Have a nice day!

             

            -Ian