Editable table "preview" of data (on dash)

I have a dash that performs a database writeback. It writes a few rows of data at a time.

I’d like my users to be able to preview the data before they’re written and edit any cells that need to be.

I’m flexible as to how it works, it just needs to be logical for the user to engage. I’ve looked at a lot of support pages and old posts and nothing seems to come close.

Any suggestions?

Thanks!

Hi Ken,

If you have designed the writeback functionality with textboxes for user inputs and then a button to actually insert the textbox content in database, then they should be able to edit/review what they want to insert before finally deciding to click the ‘update’ button. Is that not what you meant by “preview”?

It’s complicated, but no, the user is not generating the data in this case. The data are generated automatically according to a set of rules. Normally, these rules will generate the right data and the dashboard can just show a preview and the user hits “Submit” for the writeback to do the write. But in some cases, the auto-generated data might need to be altered and I’d like them to be able to do that.

How is that data generated? Can you not set the textbox controls (whose viewParameters are connected to the writeback table columns) with the generated texts using scripts?

I want to again emphasize that the data we’re looking to edit is NOT user generated. I’d like to avoid getting into specifics, as it is not related to the question.

The question is how can we edit values in a table. The user is looking at data before it goes to writeback and making any needed changes. I have looked through dozens of videos, support pages, old posts here, etc and simply cannot find anything that answers this question.

@jeff - I seem to remember a video (Off The Charts?) or sample where you clicked on a row of a table and it populated some text boxes and/or dropdowns that could then be altered and the table updated with the new values. Does my memory serve me right?

This sounds like a video I made specifically for you and didn’t make public. I don’t believe there are any that I have done that do this specifically.

That said - all the controls can have their text values modified. Do you need a sample? Give me a list of all the controls you are using, and I’ll get you some sample scripts on how to modify the value they are showing.

Cheers.

I would agree with the above suggestions.

Have some textbox controls that are populated by your script with the intended data. Maybe even disabled, but the point is that the user can see it.
Then the user clicks, ‘good to go’ and the writeback happens, or the user clicks ‘hang on a minute’ and the textbox controls become editable and the user can make changes and then click ‘I’m happy to upload now’.
We’ve done something along those lines before (obviously not the same as your super specific case :stuck_out_tongue_winking_eye:)

I do appreciate that this is good for only one or two ‘rows’ at a time, and not for a whole table.
Maybe you could have a button or just ‘on click/selection’ in each row of the table that shows and populates an ‘edit’ section/layer which is the textbox controls?

1 Like

I wasn’t asking you the nuances of your data generation logic, but was mostly interested in your setup. If the generated data has already been written back in Dundas cube and the requirement is for the user to edit them, then you can use a table visualization - click each row - populate textbox controls - edit/change text and update data row by row by some uneditable ID column or so, as @david.glickman suggested. But if the data has been generated on client side (I have seen people doing that using heavy scripting), then you can writeback directly after editing. Either way, the idea is to use textbox controls for the user to be able to input/edit texts.

1 Like

I don’t see it in any of our private comms, but I could be overlooking it. I just thought I remembered seeing you work on a sample like that in a video.

We did try to modify the value of a table’s cell by going into table1.metricSetBindings[0].dataResult.cellset.rows[0].members[7].caption = "False". It “took” the value but never displayed on the dash (even after a loadData()) so we’re not sure what we did wrong. We assumed it was just being overwritten by the table’s source data.

But that’s the only control we’re currently using - a table. The solution here is very flexible on our end, we’ll use whatever we need to make this work, just that displaying the preview data in a table is the only real constraint at the moment.

This is along the lines of what we were thinking, just not sure exactly how (script?) to get those textbox / dropdown box types populated with current values and then stored back into the table following modification.

Probably a script with the onclick or selection change of the table to populate the controls. Perhaps you could get away with a filter interaction, but I’m not sure.
Then a button to click to writeback from the parameters to the db and load the table. Assuming the table is displaying the data from the db.

You shouldn’t be able to modify a cell value in metric set directly. Let’s say, you have a setup like this where both the controls are textboxes connected to ID and Comments fields in the table. The table is sourced from a cube containing an SP that inserts values in my database. The table shows everything the database table contains by default.
image
I can type values in the textboxes and use the Update Button to do writeback
image

In your case, you can let the users select a row in table first. You can use scripts similar to samples used here: Get Selected Table Data or Using Hit Test in table. Next, you can set the viewParameters connected to those textbox controls with the extracted texts. Make sure you pass “true” in viewParameter.refreshAllAdapaters() as argument so that the controls are updated but the writeback does not happen instantly. And then the user can edit the texts loaded in textbox controls and click on update button to update the same row (depends on the SP - my SP inserts a new comment for every ID).
I have not tried to do your exact scenario - this is just an example I had but I think this will work.

1 Like

Hi Ken,

Another solution would be to build a stored procedure that takes as arguments the entries needed for creating a new row, if it doesn’t exist and/or filtering the rows upon those criteria, and use this stored procedure as source for your DataCube that returns the table you want to show (setting everything to bypass cache).
Like this each time there is a modification, the stored procedure will return a different set of data.
In the Dashboard you create parameterTextBox, parameterNumeric, parameterDateTime or parameterHierarchy, and link those parameters to Bridge Parameters in the DataCube in order to set the parameters of the stored procedure, they have to be out of the zone used for the visualisation, in order to hide them (do not use the hidden setting) from the end-user, depending on your needs, then you set thru javascript those parameters when the button “Update” is clicked with the values entered/selected by the end user in the parameters used by the end-user for setting the values in the visible part of the Dashboard, and you’ll just need to invoke the refreshAllAdapters(), after setting all the required parameters.
Like this you’ll decide what data will be returned by the stored procedure, and be also able to add values “on the fly”.

I hope this helps,
Olivier