Forum Discussion

Sweez's avatar
Sweez
Contributor
2 months ago
Solved

Parameter Value Not Resolved

I have an issue that I have seen before I never figured out so want to see if others have encountered this and figure out what I am doing wrong.  I have a data adapter that calls a Dashboard Dataset BR to get populated.  I pass in a parameter like "Parameter1=|!SomeOtherParam!|".  When I use "args.NameValuePairs.XFGetValue" to get the Parameter1 value is returns "|!SomeOtherParam!|".  I expect to see the actual value of SomeOtherParam or nothing but not the literal param with pipe and exclamation mark.  Has anything encountered something like this before?

  • It is related to the processing order of the components, data adapters, and parameters. In your case, the parameter „someotherparameter“ is needed to build the data adapter, but it doesn’t exist yet. And the query fails.

    The solution is easy, you just need to test, if the parameter already exists, and exit the business rule if not.

    I‘m not at my desk, so I can‘t post a sample. 

  • victortei's avatar
    victortei
    New Contributor III

    Sweez, I got some of these rules working.

    In my case, it's a data adapter configured as Method -> BusinessRule

    As you can see, I'm using |!GroupName!| parameter. In my Helper Queries I have the XFGetValue

    Can you send us the same screenshot from your solution? Are you by chance enclosing your parameter with double quotes? That can make OS think those are text instead of trying to resolve them.

  • ChristianW's avatar
    ChristianW
    Valued Contributor

    It is related to the processing order of the components, data adapters, and parameters. In your case, the parameter „someotherparameter“ is needed to build the data adapter, but it doesn’t exist yet. And the query fails.

    The solution is easy, you just need to test, if the parameter already exists, and exit the business rule if not.

    I‘m not at my desk, so I can‘t post a sample. 

    • ChristianW's avatar
      ChristianW
      Valued Contributor

      I'm using this functions

      In C#:

      public bool UnresolvedParameters(Dictionary<string, string> nameValuePairs)
      {
          foreach (KeyValuePair<string, string> kvp in nameValuePairs)
          {
              if ((StringHelper.DoesStringContainCustomSubstVarsOrSubstVarStringFunctions(kvp.Value)))
                  return true;
          }
      
          return false;
      }

      or in VB:

      Public Function UnresolvedParameters(nameValuePairs As Dictionary(Of String, String)) As Boolean
          For Each kvp In nameValuePairs
              If StringHelper.DoesStringContainCustomSubstVarsOrSubstVarStringFunctions(kvp.Value) Then Return True
          Next
      
          Return False
      End Function

       

    • MarcR's avatar
      MarcR
      VIP

      I agree with Christian, sometimes a data adapter (or other object) is triggered multiple times, if your parameter is not resolved yet it will be returned in its original name (|!name!|). to test this run a brapi that writes your parameter to the errorlog and you should see it more then once, first as the |! !| and then the updated one with the required content. As a solution you could exit your function if your parameter contains |!.
      so just add

      If sParameter.XFContainsIgnoreCase("|!") then return nothing

       

  • Thank you.  This makes sense and give me some things to test.   Appreciate the reponses all.