Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
9 replies
Subscribers
6 subscribers
Views
3461 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Process
For the Query Database Smart Service, it looks like it doesn't allow an aste
nickh413445
Certified Senior Developer
over 9 years ago
For the Query Database Smart Service, it looks like it doesn't allow an asterisk (*) anywhere within the SQL statement field. The problem I'm running into is that I need to do a multiplication function within the SQL.
How do would we do multiplication in that SQL Statement box without using the asterisk?
OriginalPostID-152904
OriginalPostID-152904
Discussion posts and replies are publicly visible
0
ankitb0003
over 9 years ago
you can use stored procedure to do your operation in SQL and get back the required result in Appian.
I am not sure about your requirement, hope this will help.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ajinkyab277
Certified Lead Developer
over 9 years ago
Hi Nick
You cannot use * in SQl statement box, But if you want to multiplication in with SQL data You can choose below options
1. Use query entity or Query rule to get the data from table and handle multiplication in Appian
2. If you want to use 'Query Database' node then first get the column value from table and then do multiplication logic in appian (to be specific use apply function in data output tab of Query database node)
Note: - Not recommended if number of rows returned is large
3. You can also use view or store procedure, but then you have to maintain 2 extra data base object and CDT and they have their own drawbacks
Thanks
Ajinkya
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ajinkyab277
Certified Lead Developer
over 9 years ago
Hi Nick,
You can use * with bracket
select (col1*2) from table1
above query is woking for me
Thanks
Ajinkya
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
nickh413445
Certified Senior Developer
over 9 years ago
The * is still not working for me even with the brackets. The * is in the where clause instead of the select statement, I'm not sure if that would make a difference.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Robert Shankin
Appian Employee
over 9 years ago
Nick -
I'm assuming this is a SQL statement you've tested working in your db client. Is that correct?
If so, would you share your SQL as if you were writing it directly in the db client?
That might help us come up with some ideas that would work for you.
Thanks,
Rob
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
nickh413445
Certified Senior Developer
over 9 years ago
Yes, the SQL statement runs without any problem on the db client. I can't post the formula we're using, but here is a generic SQL statement that is giving me the same error:
SELECT any_column FROM generic_table where 180*tan(45)*cos(45)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
nickh413445
Certified Senior Developer
over 9 years ago
So I was able to get around this by using the a!query rule in SAIL, and then by applying the math funtion using the index(where(search())) to the result set.
So I have:
local!AllDetails: a!queryEntity()...
...
local!filter: index(
local!AllDetails.data,
where(
search(
180*tan(45)*cos(local!AllDetails.data.field),
180*tan(45)*cos(local!AllDetails.data.field)
)
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Robert Shankin
Appian Employee
over 9 years ago
Glad you found your solution, Nick.
It can be difficult to get comfortable querying databases without SQL using Appian. But, Appian has been designed to enable designers to do exactly that.
It's recommended that you avoid use of the query database smart service, or keep it in mind as a last resort. Appian's query rules and functions are more secure in the Appian context, and configurations that use the query database smart service tend to involve more steps when the time comes to promote applications across environments.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
hanyh
over 8 years ago
The way I was able to get around this is to use division on the other side of the equation instead of multiplication for ex if the where condition is "where column1 = column2 * a ", I replaced it by "where column1/a=column2"
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel