Is the Command_SQL parameter of ExecuteSelectToExcel capable of handling WHERE clauses? Such as CreatedOn BETWEEN fromDate AND toDate?
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.