Customer Portal

Parameterizing Several Lists to Build a URL

Comments 7

  • Avatar
    admin
    0
    Comment actions Permalink
    Hi,

    If I understand you correctly, you need to create URLs for every possible combination of two lists of "parameters" (one list is "KPIs" and another is "games"), right? In fact, to achieve that by using Jobflow with parameters, you would actually need a Jobflow in another Jobflow.

    However, I believe that there is another approach you should consider. If you prepare the input data first, you can then create the URLs in the same graph. In order to do that you can use a component called CrossJoin. This component will join KPIs and Games to a single table with two columns and creates every possible combination of them (joins each KPI with each game). Then you can add a component Reformat with a Transform function that would look as follows:

    $out.0.URLpath=concat("http://www.website.com/dashboard/",$in.0.KPI,".html?game_app_id=",$in.0.game);


    The output of this Reformat component will be a list of URLs that you can then pass to HTTP connector component. I am attaching a graph for review. Please give this a try and let me know if it meets your requirements.

    Thanks Eva
  • Avatar
    kmac21
    0
    Comment actions Permalink
    That worked beautifully! Thank you! I have one last question. Because I was using parameters before I was writing the output file from the HTTPConnector as ${game}_${kpi}.json, but now that I am not using parameters so how can I get the same result?
  • Avatar
    kmac21
    0
    Comment actions Permalink
    Here is what I tried that has not worked:

    In the HTTPConnector in Output Mapping:
    function integer transform() {
    $out.0.content = $in.1.content;
    $out.0.FileName = concat($in.0.game,"_",$in.0.kpi);

    return ALL;
    }


    I am connecting the HTTPConnector to the UniversalDataWriter component with the following settings:
    File URL: ${DATAOUT_DIR}/#.txt
    Exclude Fields: FileName
    Partition key: FileName

    The result I am getting is:
    1.txt
    2.txt
    3.txt
    etc.
  • Avatar
    svecp
    0
    Comment actions Permalink
    There's probably one additional attribute which needs to be set:

    Partition file tag = Key file tag
  • Avatar
    kmac21
    0
    Comment actions Permalink
    So I am almost there! I added the setting "Partition file tag: Key file tag" to the UniversalDataWriter properties while keeping the other settings mentioned above. This works and gives me the file with the correct file name, but it also gives me duplicate files of everything except that they are named i.e. 0.txt1, 0.txt2, 0.txt3, etc. How can I make it so I am not getting these duplicate files while keeping the files that product the correct name?
  • Avatar
    kmac21
    0
    Comment actions Permalink
    The setting "Partition file tag: Key file tag" worked. The reason I thought I was getting duplicate files was that even though I removed them from designer it had not completely synced with the server and the files showed up again so I thought they were being duplicated. Thanks for the help all!
  • Avatar
    svecp
    0
    Comment actions Permalink
    Glad we could help :-)

Please sign in to leave a comment.