21
Views
1
Comments
Solved
[Advance Query] Command_SQL parameter of ExecuteSelectToExcel capable of handling WHERE clauses?
advancequery
Web icon
Forge asset by oDevFagundes
Application Type
Traditional Web

Is the Command_SQL parameter of ExecuteSelectToExcel capable of handling WHERE clauses? Such as CreatedOn BETWEEN fromDate AND toDate?

2025-12-09 14-11-18
Janakiraman JR
Solution

Hi Andrew,

Yes, the Command_SQL parameter of the ExecuteSelectToExcel action in the Advance Query Forge component can handle WHERE clauses. 

Here’s a corrected and safe version of what you’re trying to do:

"SELECT {" + GetApplicationEntitiesByApplicationId.List.Current.Entity.Name + "}.*  FROM {" + GetApplicationEntitiesByApplicationId.List.Current.Entity.Name + "}  WHERE {" + GetApplicationEntitiesByApplicationId.List.Current.Entity.Name + "}.CreatedOn  BETWEEN #" + DateToStr(fromDate) + "# AND #" + DateToStr(toDate) + "#"

  • Use DateToStr() or TextToDate() if you're dynamically injecting date values.

  • Use # symbols to wrap date literals in SQL Server syntax if required.

  • Ensure fromDate and toDate are properly sanitized.


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