Hi
I have below code in Sub Report -
DECLARE @TipoObjeto VARCHAR(10)
DECLARE @DocEntry INT
DECLARE @Comando VARCHAR(MAX)
DECLARE @Tabela VARCHAR(3)
SET @TipoObjeto = x
In Main Report i have given
Shared NumberVar x := 5;
Hi
I have below code in Sub Report -
DECLARE @TipoObjeto VARCHAR(10)
DECLARE @DocEntry INT
DECLARE @Comando VARCHAR(MAX)
DECLARE @Tabela VARCHAR(3)
SET @TipoObjeto = x
In Main Report i have given
Shared NumberVar x := 5;
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Soumyakanta RoutPosted Aug 21, 2023, 4:45 AM
DECLARE @TipoObjeto VARCHAR(10)
DECLARE @DocEntry INT
DECLARE @Comando VARCHAR(MAX)
DECLARE @Tabela VARCHAR(3)
SET @TipoObjeto = SharedNumberVar x -- Use SharedNumberVar to access the shared variable value
Muhammad Imran AnsariPosted Aug 20, 2023, 5:40 PM
In Crystal Reports, shared variables need to be declared at the beginning of the formula and before they are used. Here's some modification:
Main Report:
Shared NumberVar x := 5;
Sub Report:
// Declare the shared variable at the beginning of the formula
Shared NumberVar x;
// Your Variables in sub report
DECLARE @TipoObjeto VARCHAR(10);
DECLARE @DocEntry INT;
DECLARE @Comando VARCHAR(MAX);
DECLARE @Tabela VARCHAR(3);
// Assign the shared variable value to a local variable
x := {@MainReportFormula}; // This retrieves the value of x from the main report
// Now you can use x in your subreport code
SET @TipoObjeto = ToText(x);