Deprecated GetLiteralParameterValue and SetLiteralParameterValue replacements?

RobbSalzmann
Valued Contributor

I'm getting the message "'Function GetLiteralParameterValue(si As SessionInfo, isSystemLevel As Boolean, parameterName As String) As String' is obsolete: 'This is a temporary function used by Marketplace Solutions for backwards compatibility with old XF versions. Please change your code to use supported functionality.'."

 

Anyone know what object & method should I be using instead?

 

 

strSomeString = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si,Nothing,"pm_SomeParameter")

 

 

 

3 ACCEPTED SOLUTIONS

amoore
New Contributor II

Hi Robb, 

Here's guidance for 7.3.1. In 7.4, more functions are coming for workspaces as the workspace features evolve. 

If you hover over the intellisense after Parameters. you will see a down arrow showing a second function which is the new implementation of the function. This function incorporates the Workspace ID as a GUID. 
Old:

amoore_0-1679437295512.png

New:

amoore_1-1679437499112.png


If the dashboard is located under the default workspace, use Guid.Empty as shown below. 

amoore_2-1679437636747.png

If the dashboard object is located under a Named Workspace, you want to pass through the Workspace ID for that Workspace so at runtime it can locate the literal value parameter since that same parameter name can now be used in another workspace. 

Hope this helps! 

View solution in original post

ChrisLoran
Valued Contributor

(Edit: I removed my earlier response as it is now obsolete)

View solution in original post

My apologies for some confusion, I was testing on a beta-release prior to the documentation (thanks AMoore the clarifying).
I have installed the v7.4 general release and confirm this is how to access a Literal Parameter Value from a named workspace other than default:

ChrisLoran_0-1679567483790.png

 

Dim strParamValue As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si,False,Nothing,"ChrisWS.TXP_UD1_TJ")
brapi.ErrorLog.LogMessage(si, strParamvalue)

 

Output:

ChrisLoran_1-1679567519071.png

Note: If you are accessing a Literal Parameter defined in a different workspace then that workspace will have to be defined as [Is Shareable Workspace] = True. Default is False. If False then the GetLiteralParameterValue returns the string "Unknown".

ChrisLoran_2-1679568020917.png

View solution in original post

19 REPLIES 19

amoore
New Contributor II

Hi Robb, 

Here's guidance for 7.3.1. In 7.4, more functions are coming for workspaces as the workspace features evolve. 

If you hover over the intellisense after Parameters. you will see a down arrow showing a second function which is the new implementation of the function. This function incorporates the Workspace ID as a GUID. 
Old:

amoore_0-1679437295512.png

New:

amoore_1-1679437499112.png


If the dashboard is located under the default workspace, use Guid.Empty as shown below. 

amoore_2-1679437636747.png

If the dashboard object is located under a Named Workspace, you want to pass through the Workspace ID for that Workspace so at runtime it can locate the literal value parameter since that same parameter name can now be used in another workspace. 

Hope this helps! 

hiren
New Contributor III

[Off Topic]
@amoore Do I see an IDE? Any guide on how to set it up?

I'd like details on this too please

hiren
New Contributor III

Thanks @sudarshan for point me to the Post where this was discussed earlier. Also, the assemblies can be grabbed from OneStream client directory. 

Thank you

ChrisLoran
Valued Contributor

(Edit: I removed my earlier response as it is now obsolete)

@ChrisLoran If the parameter were in your "MySolution01" workspace, would the parameter argument be:
"MySolution01.prm_pMinEquityMethod_ECT"?

Do you know how to get the guid for a workspace?

(I removed my earlier response here as it is now obsolete)

Could you supply an example of this: "The first part of the parameter needs to be the literal word "Workspace".  Then a dot , then your workspace name, ... then  parameter name" using the prm_pMinEquityMethod_ECT param and the screenshot above pls? I'm not sure what absolute (full-path) would be based on?

With only the default workspace, I'm currently using the code below with (I think) success

 

 

strHeaderID = BRApi.Dashboards.Parameters.GetLiteralParameterValue(
                  si, False, guid.empty, "Default.pm_Header_ID")

 

My apologies for some confusion, I was testing on a beta-release prior to the documentation (thanks AMoore the clarifying).
I have installed the v7.4 general release and confirm this is how to access a Literal Parameter Value from a named workspace other than default:

ChrisLoran_0-1679567483790.png

 

Dim strParamValue As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si,False,Nothing,"ChrisWS.TXP_UD1_TJ")
brapi.ErrorLog.LogMessage(si, strParamvalue)

 

Output:

ChrisLoran_1-1679567519071.png

Note: If you are accessing a Literal Parameter defined in a different workspace then that workspace will have to be defined as [Is Shareable Workspace] = True. Default is False. If False then the GetLiteralParameterValue returns the string "Unknown".

ChrisLoran_2-1679568020917.png

Hi @ChrisLoran ,

Quick question, if the maintenance unit has spaces in the name, how would the syntax be for the same?

For example, RPTA DMU name is "XFS Application Reports (RPTA)"

 

so will the below syntax work?

BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, Nothing, "[XFS Application Reports (RPTA)].StoredManageReportsSecurity_RPTAT")

Thanks,
Nidhi Mangtani

In that case I would recommend the tip already given my AMoore in this thread, to get the workspace ID as follows:

Dim wsIdValue As Guid = BRApi.Dashboards.Workspaces.GetWorkspaceIDFromName(si, isSystemLevel, "My Workspace Name With Spaces")

In this particular call, you should not have to use [ square brackets ].
Then use the WorkspaceID on subsequent calls to work with parameters. This will be more efficient because if you repeatedly repeat the workspace name in GetLiteralParameterValue then it has to internally lookup the WorkspaceID every time, and it's less maintainable if you're pasting lots of copies of the workspace name into your BR.

Since we consultants don't have access to the platform's source code, nor do we work in product engineering, all I can do is speculate on the use of spaces in GetLiteralParameterValue, so I would test first without the square brackets, and then with them. ( But I would still rather get the workspace ID once, and re-use it several times in subsequent Parameter methods).

How can I identify the current workspaceid attached to the dashboard when working in a dashboard extender rule?  perhaps I have the same named parameter in two different workspaces but they call to the same extender but I would like to set the appropriate parameter based on the workspaceid of the caller?

RobbSalzmann
Valued Contributor

@amoore @ChrisLoran Thank you both for explaining both how and why.  This is very helpful.

amoore
New Contributor II

@RobbSalzmann  - to expand of Chris response related to 7.4. There are a number of BRApi functions coming surrounding workspaces that will assist with this functionality like "GetWorkspaceIDFromName". An example of this in 7.4 would be: 

Dim wsIdValue As Guid = BRApi.Dashboards.Workspaces.GetWorkspaceIDFromName(si, isSystemLevel, workspaceName)

In 7.3, although there is no BRApi function to obtain the workspace ID when using a named workspace, you can pass through args as DashboardExtenderArgs in your function signature and then specify args.PrimaryDashboard.WorkspaceID. As a note though, this implementation may run into problems if you need to lookup objects across multiple workspaces dynamically based using Workspace Name to obtain the ID. This where the functions in 7.4 that are coming will be more programmatically efficient for your needs. 

 

chris_rothermel
New Contributor III

RE:  Warning at line 52:  'Sub SetLiteralParameterValue(si As
SessionInfo, isSystemLevel As Boolean, parameterName As String, newValue As
String)' is obsolete: This is a temporary function used by Marketplace
Solutions for backwards compatibility with old XF versions. Please change your
code to use supported functionality.

So what's the new functionality?  Same subroutine name just different parameters.  Old one still works but it is deprecated.

Snag_29e66b03.png

Thanks for posting this.  I ran into the same warning message today and I was wondering exactly how "to change the code to use the supported functionality."

 

 

 

Maybe these warnings need to provide a bit more direction.

@chris_rothermel The new method signature ("2 of 2" in your image above) specifies the Workspace of the parameter on which you want to set a value is configured.  This is done by 1. setting the workspace name as a dot prefix to the parameter name- specifying guid.Empty, or 2.  parameter name without the dot prefix with a known workspace GUID provided as the 3rd arg.  This means that you can have the same parameter names doing different things in two different workspaces,

IOW, Parameters are now Workspace specific and the new method signature provides the way to tell the platform on which workspace to set the parameter value.

osdevadmin
New Contributor III

Thank you, and hat tip to @Omkareshwar for guiding some of us here, this thread is a huge time saver and full of really good contributions on resolving this error.

Please sign in! RobbSalzmann