cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

How to get a SQL Query result as an integer

leeejw717
12-Amethyst

How to get a SQL Query result as an integer

I am using a SQL query that looks something like this:

SELECT COUNT(*) FROM Location 

When I test it, I get the following:

Capture.PNGHow do I get that as an integer datatype? Because I need to bind this value to a label widget or any widget that displays values. 

 

I have tried changing the output basetype to integer and it still does not work.

 

ACCEPTED SOLUTION

Accepted Solutions
posipova
20-Turquoise
(To:leeejw717)

Can you try wrapping that service in another service and extract the result?

View solution in original post

6 REPLIES 6
posipova
20-Turquoise
(To:leeejw717)

Could you please clarify what error you are getting when you set it as an integer or number?

What is the output type in the screenshot you provided?

leeejw717
12-Amethyst
(To:posipova)

When I set it as an integer, it does not give me any errors, it just gives me the same result that is shown in the picture. (but, when I set it as an integer and save it, I see that the output basetype keeps going back to an infotable, which makes me think that this SQL query does not allow integer outputs) The output type in the screenshot I provided is supposed to be an infotable, but there is no columns.

posipova
20-Turquoise
(To:leeejw717)

Can you try wrapping that service in another service and extract the result?

leeejw717
12-Amethyst
(To:posipova)

Should I make the SQL Query spit out a datatable with 1 column so that it can store the value,

and then write a JS script that takes a datatable as an input and gets the value in the column as an integer

posipova
20-Turquoise
(To:leeejw717)

I apologize for the delayed response, for some reason I did not get a notification. Yes, that is what I had in mind. Hope it's how you proceeded and it's resolved now!

slangley
23-Emerald II
(To:posipova)

Hi @leeejw717.

 

If one of the previous responses answered your question, please mark it as the Accepted Solution for the benefit of others who may have the same question.

 

Regards.

 

--Sharon

Announcements


Top Tags