Pass variable to assign statement

Hello,
I am trying to pass variable in assign statement. I have tried putting +in front but it doesn’t work. I am trying to pass variable in place of 304 in below statement so that I have dynamic column header name

cognosreportnew.Select(“[304] IS NOT NULL”)

1 Like

@RISHI4897,
cognosreportnew.Select(“+” ’ “+yourvariable+” ’ "+“IS NOT NULL”)

1 Like

Hello Naveen,
Thanks for reply. I tried your solution but unfortunately it doesn’t work. My variable is currentcompanyno. So basically I am trying to pass company number as a variable and select all the records in that column which are not null.

For example if currentcompanyno =304 then I want to select all the records which are not null in column named 304
then if currentcompanyno =301 then I want to select all the records which are not null in column named 301

Thanks,
Rishi

1 Like

@RISHI4897,
Try This,
cognosreportnew.Select(“[”+yourvariable+“] is not null”).CopyToDataTable

yourvariable is your header name

2 Likes