I have a function that takes startdate and endDate as inputs. From within the function I perform the below operations-
- use format_datetime to convert the input date into a specified format
- use sql_request plugin and pass these formatted dates as sql parameters.
let start_time = todynamic(format_datetime(startTs, 'yyyy-MM-dd'));
let end_time = todynamic(format_datetime(endTs, 'yyyy-MM-dd'));
let query = 'select * from [db].[Table] where date > @param0 and date < @param1';
let result = evaluate sql_request(auth, query, dynamic({'param0': start_time, 'param1': end_time}))
However, on the editor I get syntax error on start_time as it says "expected '}' " and also on sql_request saying that sql_request expects 4 arguments.
How do I pass formatted datetime as part of dynamic data type? Thanks!