In msg box data is showing but when I use the variable the it is null

Hello,

I am reading data from excel after convert it to string via output datatable i can see the value of that variable but when i use that variable in run query it is null.

Hi @Mehrab_Hussain

Try to print it in output panel by using log message activity.

Hope it helps!!

Can you please show us your workflow and variable pane?

Hi @Mehrab_Hussain

Welcome to Community!!

Make sure that the variable is in scope and accessible in the activity where you are using it. If the variable is declared within a specific scope, it may not be accessible outside of that scope.

In Msg Box i can see value of ‘NewGid’ but we I use that variable in run query it becomes is null.

Query: “select name from [db].[dbo].[tab] where col ='” +NewGid+ " '"

Maybe try using NewGid.tostring ?

tried still not working the scope is also same

can you show us what it says in the message box please?

It only select the column name from database.

Hey @Mehrab_Hussain ,
Check the scope of the variable in the variable panel
Keep the scope to the last most option

For example:
image

yes i have selected last option ‘trigger’. but still same issue

@Mehrab_Hussain , Can you check it in debug panel after each step and see where the variable is turning null so that we can know what’s the problem more precisely

This is the query in debug

it select only column name from database.
when I use the value instead of variable in command then it select data.

@Mehrab_Hussain Hi, can you elaborate what you want to do in Query

I want to select column ‘Location’ Form table where MID = variable “NewGid”. but when i show the result of that query it show only column name ‘location’ in message box. this is the query “Select Location From [POS].[dbo].[Transit] where MID = ’ " +NewGid+”'"
and this the query that i can see in debug: @“Select Location From [POS].[dbo].[Transit] where MID = ’ 347f859d-a8d8-4779-b5fc-ab1f52e52f9c
'”

@Mehrab_Hussain “NewGid” contains locations and you want to get data against these locations. Right?

@Mehrab_Hussain
Can you show me desire output ?


this is the output I want. i can get that output when I use ‘347f859d-a8d8-4779-b5fc-ab1f52e52f9c’ instead of variable but this variable also contain same value.

Not NEWGid contains ‘347f859d-a8d8-4779-b5fc-ab1f52e52f9c’ and this same data is in MID column i have compare there values and select location

@Mehrab_Hussain did you check variable contains same value?