Hi All,
Before I start detailing my process and train of thought I should mention my goal because perhaps there is a better/simpler way to achieve my goal of capturing user interaction with our application.
Right now we have a grid component with search section. Whenever a user submits a search form I call a stored procedure in the "AfterSearch" event handler that creates an EventId in a db table "WebUserSessionEvents" and returns that EventId to the xbasic "AfterSearch" event handler. I split each line in "Args.rtc.sql_allArguments" into an array. For each element in the array I parse out the search field and value and call a stored procedure that stores the current EventId, the field being searched, and the value submitted in a database table WebUserSearchActions. This data is stored in two fields "SearchField" and "SearchValue".
If there are multiple search values submitted we keep the same EventId and loop through the array saving each field/value pair to the database WebuserSearchActions table using the same EventId. The EventId is what ties all the different field/value pairs to a particular user click.
So this all works fine and dandy. The challenge is we have some preset search filters that display our project data at certain progress points that we think will be useful to our stakeholders and we also would like to track whether or not they are using these features. The way the presets work is by using javascript to change the search form values in the ajax search controls and then submitting them to the server. So when they run through the AfterSearch they look identical to a search that a user would construct themselves.
The way I was imagining the system for recording preset selections was creating an EventId in an AjaxCallBack when the user clicks one of our presets, storing the name of the preset selected in its own db table, and somehow passing the EventId to "AfterSearch" function which will save the actual preset Search Values using the EventId that had been set in the AjaxCallback. The thing is I haven't figured out a way to pass the value from ajaxcallback to the AfterSearch function
I tried setting the values e._state.EventId in the callback but the value is not available in the "AfterSearch" function(perhaps because it was an async callback?). I had messed with rtc variables before but I forget how to initialize them and I'm not sure they can be initialized from outside of an event handler.
I started to think of other ways to handle the issue. One way would be to have the ajaxcallback actually return to the calling JS function the event Id and then somehow submit that to the aftersearch submit but I'm not sure the best way to do that, the submitsearch method doesn't accept any parameters and I'm not sure if there are any grid attributes I could set that will be available in the "AfterSearch" event.
Then I had another idea; I was wondering if it would be possible to bypass the ajaxcall altogether and have a hidden search filter dropdown like ISPRESET: TRUE, FALSE that gets submitted whenever the user does a search. When a user clicks a preset it gets set to true, if they use the "Search" or "Clear Filters" button it gets set to false that way I could just add a column to the "WebUserSearchTable" and store whether it was a user constructed search or a preset right there in the search table without having to use any complicated queries to reconstruct the data.
I thank everyone who has read this far. :D I know it's a lot. Any ideas would be greatly appreciated.
Before I start detailing my process and train of thought I should mention my goal because perhaps there is a better/simpler way to achieve my goal of capturing user interaction with our application.
Right now we have a grid component with search section. Whenever a user submits a search form I call a stored procedure in the "AfterSearch" event handler that creates an EventId in a db table "WebUserSessionEvents" and returns that EventId to the xbasic "AfterSearch" event handler. I split each line in "Args.rtc.sql_allArguments" into an array. For each element in the array I parse out the search field and value and call a stored procedure that stores the current EventId, the field being searched, and the value submitted in a database table WebUserSearchActions. This data is stored in two fields "SearchField" and "SearchValue".
If there are multiple search values submitted we keep the same EventId and loop through the array saving each field/value pair to the database WebuserSearchActions table using the same EventId. The EventId is what ties all the different field/value pairs to a particular user click.
So this all works fine and dandy. The challenge is we have some preset search filters that display our project data at certain progress points that we think will be useful to our stakeholders and we also would like to track whether or not they are using these features. The way the presets work is by using javascript to change the search form values in the ajax search controls and then submitting them to the server. So when they run through the AfterSearch they look identical to a search that a user would construct themselves.
The way I was imagining the system for recording preset selections was creating an EventId in an AjaxCallBack when the user clicks one of our presets, storing the name of the preset selected in its own db table, and somehow passing the EventId to "AfterSearch" function which will save the actual preset Search Values using the EventId that had been set in the AjaxCallback. The thing is I haven't figured out a way to pass the value from ajaxcallback to the AfterSearch function
I tried setting the values e._state.EventId in the callback but the value is not available in the "AfterSearch" function(perhaps because it was an async callback?). I had messed with rtc variables before but I forget how to initialize them and I'm not sure they can be initialized from outside of an event handler.
I started to think of other ways to handle the issue. One way would be to have the ajaxcallback actually return to the calling JS function the event Id and then somehow submit that to the aftersearch submit but I'm not sure the best way to do that, the submitsearch method doesn't accept any parameters and I'm not sure if there are any grid attributes I could set that will be available in the "AfterSearch" event.
Then I had another idea; I was wondering if it would be possible to bypass the ajaxcall altogether and have a hidden search filter dropdown like ISPRESET: TRUE, FALSE that gets submitted whenever the user does a search. When a user clicks a preset it gets set to true, if they use the "Search" or "Clear Filters" button it gets set to false that way I could just add a column to the "WebUserSearchTable" and store whether it was a user constructed search or a preset right there in the search table without having to use any complicated queries to reconstruct the data.
I thank everyone who has read this far. :D I know it's a lot. Any ideas would be greatly appreciated.