🎉 🎉 RAPIDMINER 9.10 IS OUT!!! 🎉🎉

Download the latest version helping analytics teams accelerate time-to-value for streaming and IIOT use cases.

CLICK HERE TO DOWNLOAD

Publishing Twitter Link to Web App via Macro

Dayna22Dayna22 Member Posts: 6 Newbie
I am trying configure my web app to have a link to a Twitter user's profile. In the main page of my web app, I have a bar graph of count of tweets by user name. These user names are just display names and I have a data set where the user names are associated to the user screen names (unique twitter handles). To access a twitter profile, the URL is twitter.com/*userscreenname* - it will bring you directly to the user's twitter page.

In the main screen of the web app, a user can click on the user name to see a more detailed report of their tweets. This click on one of the user names in the bar graph then triggers three interactions: 1. store the user name as a macro, userName, 2. run a process that filters the twitter data to just that user name and 3. navigate to a new view in the web app where the more detailed visualizations of tweets by that user are displayed. On this more detailed display, I added an "external resource" component, configured as below:

Embedding the page as an image returns nothing and the "show link" check box gives me the below, which is all I'm looking for. I chose not to use IFRAME because I do not need a preview of the user's page


The click on the user name stores it as a macro on the main screen, but as I said above, it is just the display name, not the user screen name, which is the unique identifier to tack onto the end of the twitter url, thus I added a macro to my process that recalculates the tweet to store the filtered user's screen name as macro, userScreenName. The macro is initialized to "null" in the RM process via the Context panel.

When I click on the twitter link, it leads me to a link that is just *twitter.com/?=*, which then reloads to *twitter.com/home?=*

So - there are two issues here: 1. URL template link adds additional characters that are not in the original text entered in the URL template and 2. the process that in theory should store the userScreenName macro (process filters to one individual user and then stores their unique screen name as macro userScreenName), does not pull through the stored value as the macro since nothing gets pulled through on the tail end of the link.

Any help with the above two issues would be appreciated! Thanks.

Best Answer

  • Edin_KlapicEdin_Klapic Moderator, Employee, RMResearcher, Member Posts: 295  RM Data Scientist
    Solution Accepted
    Sorry @Dayna22 ,
    It seems I had a typo :blush:
    It should be href="https.....    and not href=""https...
    Then it works.

    Happy Mining,
    Edin

    P.S.
    An alternative solution would be to use a Text component.

    Dayna22

Answers

  • Dayna22Dayna22 Member Posts: 6 Newbie
    edited November 2020
    Update to the above: the passing macro issue through to the process was solved by clicking the "Allow processes to set app variables via context macros" on the app General Settings screen - we are now getting the macro passed through as the URL query parameter.

    The issue that still persists is the url: the link is now calculating as *twitter.com/?=*userScreenName* when it should be *twitter.com/*userScreenName* - this is causing the twitter page to not be found.

    Why is the "?=" automatically being added to the link? 

    Thanks!
  • Edin_KlapicEdin_Klapic Moderator, Employee, RMResearcher, Member Posts: 295  RM Data Scientist
    edited November 2020
    The "?=" is basically how the URL parameter settings work.
    The setup resolves to the following output: <some-url>/?variableName=variableValue
    <some-url> => twitter.com
    "?" stands for the info that there are parameters following up
    "variableName" is not existent => You left that empty in the screenshot of the Component settings
    "variableValue" is *userScreenName"

    A solution would be to manually write the text (either as ExampleSet or via Create Document (text extension)). In both solutions you would need to put the output settings to HTML and enable "raw HTML".
    In Create Document the content would be something like

    <a href=""https://twitter.com/%{userScreenName}" target="_blank">Click here to see the Twitter profile of %{userScreenName}</a>

    where target="_blank" makes the link open in a new tab.

    Happy Mining and Stay safe and Healthy,
    Edin

    BTW:
    Instead or in addition to the link text you could use an image. ;)
  • Dayna22Dayna22 Member Posts: 6 Newbie
    Hi Edin - thanks for your response. I configured the visualization to be output format HTML and checked the raw HTML box, as seen below


    The visualization is then showing the correct link text: twitter.com/*userScreenName* on the preview screen, but when hovering over the link address, copying the link address, or clicking on the link address, it shows our server URL with a multitude of text and characters after the initial domain, not the twitter URL. Is there something I am missing here?

    Thanks!! 
  • Edin_KlapicEdin_Klapic Moderator, Employee, RMResearcher, Member Posts: 295  RM Data Scientist
    Did you set it up like this?



    MarcoBarradas
  • Dayna22Dayna22 Member Posts: 6 Newbie
    Yes - the text is displaying as expected in the web app, but it is still leading to the server URL.
Sign In or Register to comment.