Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Custom Table query with parameters View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/21/2012 7:39:53 AM
   
Custom Table query with parameters
I've got a query on a custom table that I need to pass 2 parameters to. The parameters need to be in the SELECT statement and not the WHERE or ORDER BY. How would I accomplish this by creating a new webpart? Adding a query or stored procedure to the custom table, if so, how do I pass the parameters to it? Through the Columns property?

Here is the query and the parameters I need (@CenterLongitude, @CenterLatitude)

SELECT *, GEOGRAPHY::Point(Latitude, Longitude, 4326).STDistance('POINT(' + CAST(@CenterLongitude AS NVARCHAR(100)) + ' ' + CAST(@CenterLatitude AS NVARCHAR(100)) + ')')/1609.344 AS ProxDistance -- in miles
FROM Custom_Location
ORDER BY ProxDistance

User avatar
Kentico Consulting
Kentico Consulting
Accepted solutionAccepted solution
kentico_borisp - 12/21/2012 9:34:48 PM
   
RE:Custom Table query with parameters
Hello,

Yes, you can specify it ##COLUMNS## macro. Please check the below setup (link):

User image

Best regards,
Boris Pocatko

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/21/2012 9:46:53 PM
   
RE:Custom Table query with parameters
Brilliant! Thank you Boris!

Thankful to have such a flexible product to work with and a spectacular support team who knows their product inside and out!

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/21/2012 9:53:03 PM
   
RE:Custom Table query with parameters
Hello,

I am glad i could help ;) We are always glad to see when you are helping us to answer other user's question on the forums.

Happy holidays!

Best regards,
Boris Pocatko