Variable creation in a DSP

How to create a new variable in DSP

Reason why we need a variable?
The output of a flow service is available and we are in need to create a few variables in order to display the output.

We dont want to create this additional variable as part of the output of the flow service.

Thanks.

If you’re using the 6.0.1 release, there’s a manual in [install path]\Developer\doc\guides called ISDSPs&TemplatesGuide.pdf. Chapter 2 has a section called “Using the DSP Tags” that tells you how to use variables.

Hi, Bhavani.

The simplest way is to use the syntax %value yourVariable%.

If the variable you are trying to include in the template is in plain view (i.e. not in a Record, Record List, etc), the %value% tag will give you the results you need.

Remember that DSP is case-senstive when writing your template.

I’d like to add to Dan’s comment - since you don’t have the value coming in from the pipeline, using %value yourVariable% wouldn’t be able to retrieve the value since it’s not in your pipeline. But you could put the following at the beginning of your dsp page:

%value yourVariable null=‘my value’% (assigns the initial value)

Since ‘yourVariable’ won’t be in the pipeline (as you said you didn’t want to initialize it in a flow service), the dsp would set the value appropriately before you use it later in the dsp.

Will

I don’t know if I am missing the point, but when I am in a .dsp and want to create a variable that I use in either a later .dsp or in an invoked service i simply use %scope param(newVariable=‘something’)%

just be careful with the %endscope%

graham

Hi,
If the need is to create a few variables in order to display the output, then you can do it using javascript.
<script>
var newVar = ‘%value myVar%’;
</script>
and in scripted the variable "newVar " can be used to show the output.
Using Java script one can define arrays and store the values of record from the service into an array declared in JavaScript.

Kalyan

Hello All,

Still stuck with the scope and endscope. Guess somebody could correct me if i am wrong

The part of the DSP code is given below


…new variable definition
%scope param (newvar=“Dummy”)%
%endscope%
…PipelineOutput contains the flowservice output
%scope PipelineOutput%


…I want to use/manipute the “newvar” here
%value …/newvar%
%value /newvar%
%value newvar%
%endscope%

None of the 3 formats of %value fetched me the value of “newvar”. Could anyone help me fetch the value of newvar in the PipelineOutput scope

You can do one thing , use %endscope% after the retrieval purpose… Like this
…new variable definition
%scope param (newvar=“Dummy”)%
…PipelineOutput contains the flowservice output
%scope PipelineOutput%


…I want to use/manipute the “newvar” here
%value …/newvar%
%value /newvar%
%value newvar%
%endscope%
%endscope%

If the scope is nested, I am unable to fetch the contents of PipelineOutput scope

What should be used to fetch the variables under PipelineOutput scope when scope is nested.