5 Replies Latest reply on Jun 14, 2011 11:10 AM by mgores

    Referencing a field with a value stored in another field

    TurtleKoala

      Title

      Referencing a field with a value stored in another field

      Post

      I'm trying to omit records that meet the criteria

      Main::gFund>Global::gInvestmentAmount.

      gFund is a field in Global, so I know that this will not work.

      For example, if the value stored in gFund  is "FundA", I want the inequality to be evaluated as

      Main::FundA>Global::gInvestmentAmount

      and if the value stored in gFund is "FundB" I want it to evaluate as

      Main::FundB>Global::gInvestmentAmount.

      Is this possible, and how would you do it?

      Also, I want to do a check to see if the value in gFund is part of a certain value list, and if it is not I want the inequality to evaluate as

      Main::Other>Global::gInvestmentAmount

      I might be able to figure this part of it out depending on how you would accomplish the first part of my question.

        • 1. Re: Referencing a field with a value stored in another field
          philmodjunk

          It appears you are storing a field name in the global field.

          You can use set field by name with the field name in this field to enter criteria into different fields.

          Set Field By Name ["Main::" & Global::gFund ; " > " & Global::ginvestmentAmount ]

          To check to see if a value is a member of a value list:

          valueCount ( FilterValues ( ValueListItems ( Get ( FileName ) ; "ValueListNameInQuotes" ) ; Globals::gFund ) )

          Will return 1 (True) if gFund stores a value that exists in the value list.

          • 2. Re: Referencing a field with a value stored in another field
            TurtleKoala

            The second part looks like it should work. I'll try the first part but it doesn't look like what I'm looking for. I'm not trying to set a field, I'm trying to use an inequality as my criterial for ommitting multiple records. For instance, I originally had only FundA, and so my criteria was

            Main::FundA>Global::InvestmentAmount.

            Now that I have another fund, I want to be able to set another global field to tell it which fund to use in the inequality. I'm not trying to change the value stored in any field, and I'm not performing a find. I'll check to see if your suggestion works, but I think I may have not made myself clear originally.

            • 3. Re: Referencing a field with a value stored in another field
              philmodjunk

              The initial set field by name example would be used in find mode within a larger script such as:

              Enter Find Mode[]
              //use set field steps here to specify critieria for the records you want to find.

              New Record/Request
              Set Field By Name ["Main::" & Global::gFund ; " > " & Global::ginvestmentAmount ]
              Omit Record
              Set Error Capture [on]
              Perform Find

              (omit record, when in find mode is the same as manually clicking the omit button when performing a manual find.)

              There are, of course, other ways you can omit records so I may be basing my answer on an incorrect assumption of what you are trying to do here.

              • 4. Re: Referencing a field with a value stored in another field
                TurtleKoala

                Ok thanks. That should work. I didn't realize that you could switch Find Mode to Omit things from a script.

                • 5. Re: Referencing a field with a value stored in another field
                  mgores

                  Would a variable work?

                  Set var  $whichfund to Main::gfund    //to set $whichfund to FundA or FundB

                  then evaluate $whichfund>Global::gInvestmentAmount