{"id":601872,"date":"2020-03-16T13:40:42","date_gmt":"2020-03-16T12:40:42","guid":{"rendered":"https:\/\/www.devoteam.com\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/"},"modified":"2020-03-16T13:40:42","modified_gmt":"2020-03-16T12:40:42","slug":"how-to-create-a-dynamic-back-button-in-spotfire","status":"publish","type":"expert-view","link":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/","title":{"rendered":"How To Create A Dynamic &#8220;Back&#8221; Button In Spotfire"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">Some years ago I ran into this very particular problem. Let me take you back to that moment: <\/span><\/p>\n<p><span style=\"font-weight: 400\">So I made a set of pages in <a href=\"https:\/\/nl.devoteam.com\/en\/blog-post\/whats-new-in-spotfire\/\">Spotfire<\/a> and on some of these pages I wanted the users to select a bar in a bar chart. Next, I wanted the users to take this selection and look at a details page to see all the ins and outs of the data. Pretty straight forward right? <\/span><span style=\"font-weight: 400\">Later on, I also wanted the users to jump to this very same page from another page. Again, just build a button that takes you to this page and you are done, right?<\/span><\/p>\n<p><span style=\"font-weight: 400\">Well I found out it wasn&#8217;t that simple.. I stumbled on this issue that once I send the user to this details page (page 3), the user wants to go back to the page where he\/she came from. In a graph this would look something like this:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/page.png\" alt=\"Dynamic \u201cBack\u201d button\" width=\"347\" height=\"219\" class=\"alignnone wp-image-80764\" \/><\/p>\n<p><span style=\"font-weight: 400\">So from page 1 and from page 2 you want to jump to page 3, but then from page 3 you would like to have ONE button to jump back to where you came from.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Create a DocumentProperty?<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Spotfire gives you the functionality to jump from one page to another by just using a standard button (Actions). This also means that you would need two buttons to go back to the page that you came from. However, with a little help from the community, I found this very simple solution using some tiny IronPython snippets.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The idea is quite simple &#8211; if I push a button on page 1 or 2 it will bring you to page 3 AND it will set a DocumentProperty that stores the page where you came from. Then, a button on page 3 will bring you back using that DocumentProperty. This is what it looks like:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/DocumentProperty.png\" alt=\"DocumentProperty\" width=\"574\" height=\"245\" class=\"alignnone size-full wp-image-80765\" \/><\/p>\n<p><span style=\"font-weight: 400\">First, create a DocumentProperty. I called it LASTPAGE (Type INTEGER).<\/span><\/p>\n<h2>Create your Dynamic Back Button!<\/h2>\n<p><span style=\"font-weight: 400\">Now it&#8217;s time to create a dynamic button on page 1. Instead of creating an <em>Actions<\/em> button we have to create a <em>Script<\/em> button and insert this bit of IronPython:<\/span><\/p>\n<div class=\"block-fullwidth-dark\">\n<p><span style=\"font-weight: 400\">Document.Properties[&#8220;LASTPAGE&#8221;] = Document.Pages.IndexOf(Document.ActivePageReference)<\/span><\/p>\n<p><span style=\"font-weight: 400\">Document.ActivePageReference = Document.Pages[2]<\/span><\/p>\n<\/div>\n<p><span style=\"font-weight: 400\">The first line stores the page number where we are at the moment (be aware, we are at page 1, but Spotfire refers to it as page 0). The second line brings us to page 2 in the document, which is page 3 in my story. Again, Spotfire starts counting at 0.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can now copy this button to all the pages you want to use it to go to page 3.<\/span><\/p>\n<p><span style=\"font-weight: 400\">So now we are at page 3 and our DocumentProperty is filled with 0, since that is the page where we came from. Then, on page 3 we will insert a new button, the dynamic BACK button. And in this button we will also add some IronPython:<\/span><\/p>\n<div class=\"block-fullwidth-dark\">\n<p><span style=\"font-weight: 400\">LASTPAGE=Document.Properties[&#8220;LASTPAGE&#8221;]\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Document.ActivePageReference = Document.Pages[LASTPAGE]<\/span><\/p>\n<\/div>\n<p><span style=\"font-weight: 400\">And that is it. This script sets a variable to be the value of the page where we came from and then take you back to this page. And of course we can improve this code by changing the value of LASTPAGE to something invalid like -1, to make sure the dynamic button only works if you really came from another page. But basically, we are done, and we can navigate in a very comfortable way.<\/span><\/p>\n<div class=\"block-fullwidth-dark\">\n<h3>More about Tibco Spotfire?<\/h3>\n<p>Want to learn more about Tibco&#8217;s Spotfire and the value it can bring your organization&#8217;s decision-making processes through insight? Spotfire gives you dashboards on your data that show insights, predict the future, and are real-time.<\/p>\n<div class=\"row-more clearfix\"><a href=\"https:\/\/nl.devoteam.com\/en\/tibco-spotfire-knowledge\/\" class=\"bt-more\">More Spotfire<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Some years ago I ran into this very particular problem. Let me take you back to that moment: So I made a set of pages in Spotfire and on some of these pages I wanted the users to select a bar in a bar chart. Next, I wanted the users to take this selection [&hellip;]<\/p>\n","protected":false},"featured_media":352103,"template":"","categories":[],"tags":[2717],"industry":[],"class_list":["post-601872","expert-view","type-expert-view","status-publish","has-post-thumbnail","hentry","tag-netherlands-en-nl"],"acf":[],"cards":"\n\t<div class=\"single-post-card\">\n\n\t\t<figure class=\"wp-block-post-featured-image\"><a href=\"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/\" target=\"_self\" ><img width=\"2560\" height=\"1709\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"How To Create A Dynamic &#8220;Back&#8221; Button In Spotfire\" style=\"aspect-ratio:4\/3;width:100%;object-fit:cover;\" decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg 2560w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-300x200.jpg 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-1024x684.jpg 1024w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-768x513.jpg 768w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-1536x1025.jpg 1536w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-2048x1367.jpg 2048w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><\/a><\/figure>\n\n\t\t\n\t\t<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-43282307 wp-block-group-is-layout-flex\">\n\t<p style=\"font-style:normal;font-weight:700\" class=\"has-link-color wp-elements-1 wp-block-lp-post-type has-text-color has-primary-color has-small-font-size\">Expert View<\/p>\n\n\t\t\n\t\t<h3 style=\"font-style:normal;font-weight:400\" class=\"wp-block-post-title has-base-font-size\"><a href=\"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/\" target=\"_self\" >How To Create A Dynamic &#8220;Back&#8221; Button In Spotfire<\/a><\/h3><\/div>\n\t\t\n\t<\/div>\n\n","yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.4 (Yoast SEO v28.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How To Create A Dynamic &quot;Back&quot; Button In Spotfire | Devoteam<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Create A Dynamic &quot;Back&quot; Button In Spotfire\" \/>\n<meta property=\"og:description\" content=\"&nbsp; Some years ago I ran into this very particular problem. Let me take you back to that moment: So I made a set of pages in Spotfire and on some of these pages I wanted the users to select a bar in a bar chart. Next, I wanted the users to take this selection [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/\" \/>\n<meta property=\"og:site_name\" content=\"Devoteam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/how-to-create-a-dynamic-back-button-in-spotfire\\\/\",\"url\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/how-to-create-a-dynamic-back-button-in-spotfire\\\/\",\"name\":\"How To Create A Dynamic \\\"Back\\\" Button In Spotfire | Devoteam\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/how-to-create-a-dynamic-back-button-in-spotfire\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/how-to-create-a-dynamic-back-button-in-spotfire\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/devoteam.info\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg\",\"datePublished\":\"2020-03-16T12:40:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/how-to-create-a-dynamic-back-button-in-spotfire\\\/#breadcrumb\"},\"inLanguage\":\"en-NL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/how-to-create-a-dynamic-back-button-in-spotfire\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-NL\",\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/how-to-create-a-dynamic-back-button-in-spotfire\\\/#primaryimage\",\"url\":\"https:\\\/\\\/devoteam.info\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg\",\"contentUrl\":\"https:\\\/\\\/devoteam.info\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg\",\"width\":2560,\"height\":1709},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/how-to-create-a-dynamic-back-button-in-spotfire\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Expert View\",\"item\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/expert-view\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Create A Dynamic &#8220;Back&#8221; Button In Spotfire\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/#website\",\"url\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/\",\"name\":\"Devoteam\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/devoteam.info\\\/en-nl\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-NL\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Create A Dynamic \"Back\" Button In Spotfire | Devoteam","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/","og_locale":"en_US","og_type":"article","og_title":"How To Create A Dynamic \"Back\" Button In Spotfire","og_description":"&nbsp; Some years ago I ran into this very particular problem. Let me take you back to that moment: So I made a set of pages in Spotfire and on some of these pages I wanted the users to select a bar in a bar chart. Next, I wanted the users to take this selection [&hellip;]","og_url":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/","og_site_name":"Devoteam","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/","url":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/","name":"How To Create A Dynamic \"Back\" Button In Spotfire | Devoteam","isPartOf":{"@id":"https:\/\/devoteam.info\/en-nl\/#website"},"primaryImageOfPage":{"@id":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/#primaryimage"},"image":{"@id":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/#primaryimage"},"thumbnailUrl":"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg","datePublished":"2020-03-16T12:40:42+00:00","breadcrumb":{"@id":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/#breadcrumb"},"inLanguage":"en-NL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/"]}]},{"@type":"ImageObject","inLanguage":"en-NL","@id":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/#primaryimage","url":"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg","contentUrl":"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg","width":2560,"height":1709},{"@type":"BreadcrumbList","@id":"https:\/\/devoteam.info\/en-nl\/expert-view\/how-to-create-a-dynamic-back-button-in-spotfire\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/devoteam.info\/en-nl\/"},{"@type":"ListItem","position":2,"name":"Expert View","item":"https:\/\/devoteam.info\/en-nl\/expert-view\/"},{"@type":"ListItem","position":3,"name":"How To Create A Dynamic &#8220;Back&#8221; Button In Spotfire"}]},{"@type":"WebSite","@id":"https:\/\/devoteam.info\/en-nl\/#website","url":"https:\/\/devoteam.info\/en-nl\/","name":"Devoteam","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/devoteam.info\/en-nl\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-NL"}]}},"uagb_featured_image_src":{"full":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1.jpg",2560,1709,false],"thumbnail":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-150x150.jpg",150,150,true],"medium":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-300x200.jpg",300,200,true],"medium_large":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-768x513.jpg",768,513,true],"large":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-1024x684.jpg",1024,684,true],"1536x1536":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-1536x1025.jpg",1536,1025,true],"2048x2048":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/chuttersnap-eH_ftJYhaTY-unsplash-scaled-1-2048x1367.jpg",2048,1367,true]},"uagb_author_info":{"display_name":"group.it.system","author_link":"https:\/\/devoteam.info\/en-nl\/author\/"},"uagb_comment_info":0,"uagb_excerpt":"&nbsp; Some years ago I ran into this very particular problem. Let me take you back to that moment: So I made a set of pages in Spotfire and on some of these pages I wanted the users to select a bar in a bar chart. Next, I wanted the users to take this selection&hellip;","_links":{"self":[{"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/expert-view\/601872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/expert-view"}],"about":[{"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/types\/expert-view"}],"version-history":[{"count":0,"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/expert-view\/601872\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/media\/352103"}],"wp:attachment":[{"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/media?parent=601872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/categories?post=601872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/tags?post=601872"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/devoteam.info\/en-nl\/wp-json\/wp\/v2\/industry?post=601872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}