Jump to content
  • 0

Updating multiple records using image selection



I'm stuck on an issue and I'm hoping somebody will be able to help!
What I have so far:
a table named "Datasources" with a single line for each entry with 2 fields - project and datasource
Each Project can have multiple datasources, so some projects may have 20 entries or some may have only 2 or 3, so the table looks like this:
[ProjectA] [Datasource1]
[ProjectA] [Datasource2]
[ProjectA] [Datasource3]
[ProjectB] [Datasource1]
[ProjectB] [Datasource5]
[ProjectB] [Datasource8]
etc etc
What I need to do:
I would then like to set up a datapage, which is like a shop of sorts.  It will display 20 different images relating to a library of items available for selection.  These would be Datasources 1-20.
I would like this page to display all of these logos, but show visually somehow if they have already been selected by that particular project in the Datasources table.  So in the example above, when somebody from ProjectB views the table, they will see all 20 datasources, but only Datasource 1, 5 and 8 will be ticked.
They then need to be able to select new ones should they wish.  So they can click on the logos for Datasource 6, 9 and 10, and when they click the update button those 3 new entries will be passed to the Datasources table.  When they refresh the page, Datasources 1,5,6,8,9,10 are all ticked.
The issues I have are:
How can I get the datapage to search every item in the table and show a different image (i.e. one with a tick overlayed) if that particular project has already selected that datasource?  i.e. search table, IF project = ProjectA and Datasource = Datasource2 anywhere in the table, display image "datasource2-ticked".  I don't want it to just search one line of the table, but the whole table.
How can I get the page of logos to update multiple lines in the same table?
i.e. Datasource1 image = "datasource1-grey" UNLESS it has already been selected, in which case image = "datasource1-ticked".  Onclick image becomes "datasource1-colour" AND a new record is created with @Project in project column and Datasource1 in @Datasource column.
And at the same time this can be done if multiple logos are selected, a new record is created for each one.
Many thanks
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi Nikki,

What you are trying to do requires some complexity logic. I would try to provide you with the steps but you can contact me if you get lost in any of them, I will leave my contact info at the end of this post.

  1. In your Datasources table, you should have two different fields for your images. One for the unselected and other one for the selected images that will display accordingly.
  2. You must authenticate your tabular datapage, in the authentication, you must include the project the user belongs to.
  3. Your tabular report datapage should be based in your Datasources table.
  4. When you get to the results part, add a calculated field and place the following code:
    SELECT COUNT(Project_ID_Field) FROM Table_Name_Here WHERE PROJECT = 'Project ID Field from Authentication' AND DATASOURCE = 'Datasource Field from Table'


  5. If project and datasource matches, it will return a number greater than 0. This will be used to display the proper image.
  6. Add a new HTML block with the following JavaScript:
    <div id="Choose any unique field here"></div>
      var container = document.getElelemtById("Same unique field as slected above in the div");
      if (Your_Calculated_Field > 0) {    
        container.innerHTML = '<img src="corresponding img URL from your table" />';
      } else {
        container.innerHTML = '<img src="corresponding img URL from your table" />';

    This will display the proper image whether or the record exist already.

  7. Lastly, you need to send or remove Datasources accordingly. This can be done only using API, you should use POST call for inserting and DELETE call for removing. This would require some custom development but it is really simple, actually you could do it by yourself.

I hope this gives you some light for getting what you need.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...