How to use programmatic filter with domo

Hello devs,

I need help over adding multiple i frame with programmatic filter, after reading docs https://developer.domo.com/docs/embed/programmatic-filtering and trying out the JavaScript filter code (https://github.com/domoinc/domo-node-embed-filters) i am not ure how it working for different filters neither the code is working.


So is there any one who have a integration of filter in domo

Comments

  • Hi @sunny

    How is it not working? What have you tried? Are you able to log into the sample login page with mike as the user? Did you start up the yarn server to connect to? There's a lot of moving pieces with programmatic filters. It'd be helpful to know what you tried and what the outcome of it was.

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • @GrantSmith First of all thanks for your reply.

    Steps i take to work with given repository (https://github.com/domoinc/domo-node-embed-filters). After clone i created .env file and paste the Client ID, Secret, EMBED_ID, EMBED_TYPE, then npm install (i am not using yarn).

    In terminal i write npm start for running the project. Once project started i open the http://localhost:3001/ in browser where i can simply see company login screen, after putting username and password (rachael), i entered in main screen where filter showing in top of the screen , but entering any filter like merchants and brand it's doing nothing neither any api is called in network mode.


    This is image from domo where i used filter for brand Beechnut and only beechnut data is showing


    These images are from my localhost, nothing will happened when i clicked on submit filter button


    @GrantSmith Let me know can you help me over this issues. Also please take a look at this one github issues.

    https://github.com/domoinc/domo-node-embed-filters/issues/3

  • What values are you attempting to filter on? Are you using the correct column name?

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • sunny
    sunny Member
    edited September 2021

    I have to show multiples iframe in my web app for displaying top 25 products, retail sales, website analytics.

    can we do a real time chat for discussions.

    I am trying brand, merchant and project team name

  • Also one more thing why ports is undefined


    ```window.addEventListener("message", e => {

    console.log('received message on window', e);

    console.log("e.ports[0]", e.ports[0]);

    // Check origin

    if (!e.ports[0]) return;

    const referenceId = e.data.referenceId;

    console.log(`referenceId = ${referenceId}`);

    const port = e.ports[0];


    port.start();


    const onPortMessage = e => {

    if (e.data.method) {

    console.log(`received rpc event message with referenceId = ${referenceId} and method ${e.data.method}`);

    switch(e.data.method) {

    case '/v1/onDrill':

    const filters = e.data.params['filters'];

    console.log(`filters = ` + JSON.stringify(filters));

    const iframe = document.querySelector(`#iframe${referenceId}`);

    if (window.ENV.REPLACE_IFRAME) {

    iframe.src = `/embed/page?filters=${JSON.stringify(filters)}`

    }

    break;

    case '/v1/onFrameSizeChange':

    console.log(`width = ${e.data.params['width']}`);

    console.log(`height = ${e.data.params['height']}`);

    break;

    default:

    console.log('params = ' + JSON.stringify(e.data.params));

    }

    }

    if (e.data.hasOwnProperty('result')) {

    console.log(`received rpc response message with referenceId = ${referenceId}`);

    const result = e.data.result;

    console.log(`result = ${result}`);

    }

    if (e.data.error) {

    console.log(`received rpc error message with referenceId = ${referenceId}`);

    console.log('error = ', e.data.error);

    }

    };


    port.onmessage = onPortMessage;

    ports[referenceId] = port;

    });```

  • Have you tried URL encoding your pfilters since you're using IFrames? You can use a website like https://www.urlencoder.org to easily convert it for you.

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • Have you tried URL encoding your pfilters since you're using IFrames? => Yes i am using i frames


    You can use a website like https://www.urlencoder.org to easily convert it for you. ==> This is just wrong thing you committed.


    Well right now i am facing different issues, in my local all iframes are woking fine but in server no iframes are workiing

  • No comment