Using Custom SQL Queries Course
Question

So in this course there is no adjacent .pdf file with the usual explanation, although i maked trought with what i'd learned previously, in the part that you have to update the entity with an increase on the salary by 5%, i don't understand how to use an input on SQL, in the Logic tab there is a percentage input parameter, but i didn't know how to use it, so a made it another way, i implemented an SQL code as the following: 

"Update {Employee}

    Set {Employee}.[Salary] = ({Employee}.[Salary] * 0.05 + {Employee}.[Salary])

    Where {Employee}.[Salary] = {Employee}.[Salary]"


Now this works at the end, but i don't think that was the way that was suposed to.

I want to know how to implement the percentage input parameter for future reference.

Can someone help me? Is it even possible to use an input on SQL?

CustomSQLExercise.png

mvp_badge
MVP
Solution

Hello there Mauro,

Hope you're doing well.


Yes, it is possible to use an input parameter for an SQL query.

You just need to Right Click on Parameters Folder and choose Add Query Parameter:

Then you should be able to use this Parameter in your SQL code.

You can do it by double-clicking in the Parameter or placing a @ before. As an example:

Then you just need to pass the value that you pretend in the query parameter:

In your case, you should pass the Percentage Input Parameter from your Server Action.

Hope that this helps you!


Kind regards,

Rui Barradas

Hello Rui,

Thank you for the quick response and elaboration.


Best Regards,

Mauro Mota

mvp_badge
MVP

Hello again Mauro,

Glad that I could help you!

If your problem is solved, please consider to mark above answer as a solution in order to close the thread and help other forum members in the future.


Thank you!


Kind regards,

Rui Barradas

Hi @Mauro 

In addition to that if you don't want to update for selected records then you can remove the WHERE clause as it's doing like 1 = 1

and you can follow the steps suggested by @Rui Barradas to add input parameters for custom SQL

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.