Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
jmc1
Contributor
Contributor

Single Configurator with iframes (changes every x seconds) creating new session each change

Hi,

 

New to the world of Qlik Sense Intregration, a recent request being able to present some of our departmental dashboards on TV screens around the office - the technical side of which we have all resolved. 

 

My problem i'm faced with is each time the html/js calls the iframe (only variation being the Region selection) it creates a new session each time, so being in 30 secs cycles this is a new session for this user every 30 secs. 

 

Is there a better way to accommodate this scenario where only the selection is timed and therefore not creating a new session each cycle?

 

Example code:




TV DEPARTMENTAL KPI





//


/* Change body background-color to change fade out color. */
body.siteshow { margin:0; padding:0; background-color:#ffffff; }
#menu
{
    font-family:Arial;
    font-size:9pt;
    display:none;
    opacity:0.00;
    -mozopacity:0.00;
    filter:alpha(opacity=0);
    position:absolute;
    top:10px;
    left:10px;
    padding:5px;
    background-color:#000000;
    color:#FFFFFF;
    border:3px dotted #999999;
}
#menu a { color:#ffffff; }
#menu a:hover { text-decoration:none; }
#title { font-size:11pt; font-weight:bold; letter-spacing:2; }
#slides { font-size:9pt; line-height:16pt; }
.button { width:60px; font-size:9pt; letter-spacing:1; }


var current_idx = 0;
var slides = new Array();
var menuwin;
var show_timer;
var menu_timer;
var menu;
var content;
var loaded = true;
// Define your "slides". 3 values for each are:
//      1. Duration in seconds.
//      2. Title to be used in menu.
//      3. Source URL. Can be full URI or a relative URL.
slides[1] = new Array(30, "North West", https://<SERVER>/single/?appid=9f124c06-0b36-4c11-9f60-4f0d8c5253af&sheet=648a177c-c6dd-4365-8055-8aabf91673c5&select=Region,NW");
slides[2] = new Array(30, "North East", "https://<SERVER>/single/?appid=9f124c06-0b36-4c11-9f60-4f0d8c5253af&sheet=648a177c-c6dd-4365-8055-8aabf91673c5&select=Region,NE");
slides[3] = new Array(30, "Central West", "https://<SERVER>/single/?appid=9f124c06-0b36-4c11-9f60-4f0d8c5253af&sheet=648a177c-c6dd-4365-8055-8aabf91673c5&select=Region,CW");
slides[4] = new Array(30, "Central East", "https://<SERVER>/single/?appid=9f124c06-0b36-4c11-9f60-4f0d8c5253af&sheet=648a177c-c6dd-4365-8055-8aabf91673c5&select=Region,CE");
slides[5] = new Array(30, "South West", "https://<SERVER>/single/?appid=9f124c06-0b36-4c11-9f60-4f0d8c5253af&sheet=648a177c-c6dd-4365-8055-8aabf91673c5&select=Region,SW");
slides[6] = new Array(30, "South East", "https://<SERVER>/single/?appid=9f124c06-0b36-4c11-9f60-4f0d8c5253af&sheet=648a177c-c6dd-4365-8055-8aabf91673c5&select=Region,SE");
function MenuInit()
{
    var html = "";
    for(idx=1; idx<slides.length; idx++) {
        html += '<a href="javascript&colon;Navigate('+idx+')">' +
            slides[idx][1] + "</a><br />\n";
    }
    document.getElementById("slides").innerHTML = html;
    menu.style.display = "block";
}
function MenuShow()
{
    clearTimeout(menu_timer);
    opacity('menu', 0, 90, 500);
    menu_timer = setTimeout("MenuHide()", 3500);
}
function MenuHide()
{
    opacity('menu', 90, 0, 500);
}
function Pause()
{
    clearTimeout(show_timer);
    document.getElementById('play').style.display = "block";
    document.getElementById('pause').style.display = "none";
}
function Navigate(slide_idx)
{
    clearTimeout(show_timer);
    if (current_idx == 0) {
        if (!slide_idx) { slide_idx = 1; }
        current_idx = slide_idx;
        content.src=slides[current_idx][2];
        document.getElementById('play').style.display = "none";
        document.getElementById('pause').style.display = "block";
        show_timer = setTimeout("Navigate()", slides[current_idx][0]*1000);
        return;
    }
    if (slide_idx) {
        current_idx = slide_idx;
        content.src=slides[current_idx][2];
        document.getElementById('play').style.display = "block";
        document.getElementById('pause').style.display = "none";
        return;
    }
    loaded = false;
    current_idx++;
    if ( current_idx == slides.length) { current_idx = 1; }
    opacity('content', 100, 0, 500);
    document.getElementById('play').style.display = "none";
    document.getElementById('pause').style.display = "block";
    show_timer = setTimeout("Navigate()", slides[current_idx][0]*1000);
    return;   
}
function opacity(id, opacStart, opacEnd, millisec)
{
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
        if (opacEnd == 0) { setTimeout("FadeOutTrigger('"+id+"')",((timer-1) * speed));; }
        //if (opacEnd == 0) { FadeOutTrigger(id); }
    } else if(opacStart < opacEnd) {
        if (opacStart == 0) { FadeInTrigger(id); }
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}
//change the opacity for different browsers
function changeOpac(opacity, id)
{
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
function FadeOutTrigger(id)
{
    //alert('FadeOut: '+id);
    switch(id) {
    case "menu":
        document.getElementById(id).style.display = "none";
        break;
    case "content":
        content.src=slides[current_idx][2];
        //setTimeout("opacity('content', 0, 100, 500)", 1000);
        break;
    default:
        break;
    }
}
function FadeInTrigger(id)
{
    //alert('FadeIn: '+id);
    switch(id) {
    case "menu":
        document.getElementById(id).style.display = "block";
        break;
    case "content":
        //opacity('content', 0, 100, 500);
        break;
    default:
        break;
    }
}
function FadeInContent()
{
    if (!loaded) {
        opacity('content', 0, 100, 500);
        loaded = true;
    }
}
function LoadTrigger()
{
    //self.resizeTo(1366,768);
    menu = document.getElementById('menu');
    content = document.getElementById('content');
    Navigate();
    MenuInit();
    MenuShow();
}
window.onload = LoadTrigger;





    Views
    
    
    
        
        
    

 

0 Replies