Zum Hauptinhalt gehen

Kommentare

3 Kommentare

  • Kevin Rathgeber

    Our team has built a workflow to list the presets as a drop down for this that also can have a default set or take a querystring parameter to set at load.
     

    If interested, we can supply the workflow.
     

    0
  • Bruce Reagan

    i would be very interested in this.  I've been working on the querystring parameter from a url for a while with limited success.

    0
  • Kevin Rathgeber

    Hopefully this works

    Workflow JSON for import

    {"_properties":{"isServerWorkflow":false},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"0,10","purpose":"start","title":"Start","transitions":[{"id":93,"inputs":{},"position":"90,70 90,110","sourceConnector":"bottom","target":{"id":7}}]},{"action":"gcx:wf:forms:form:DisplayForm","id":4,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":5}}},"name":"frmPreset","position":"-270,440","title":"Display Form"},{"action":"gcx:wf:core::GetWorkflowInputs","id":7,"inputs":{},"name":"gwfi","position":"-30,110","title":"Get Workflow Inputs","transitions":[{"id":65,"inputs":{},"position":"90,170 90,200","target":{"id":76},"targetConnector":"top"}]},{"action":"gcx:wf:core::ParseUrl","id":40,"inputs":{"url":{"accessors":[],"annotations":[],"code":"null","source":"null"}},"name":"appUrl","position":"-270,330","title":"Parse URL","transitions":[{"id":42,"inputs":{},"position":"-150,390 -150,440","target":{"id":4}}]},{"action":"gcx:wf:core::Exit","id":63,"inputs":{},"position":"250,460","title":"Exit"},{"action":"gcx:wf:core::Annotation","description":"## Overview\nProvides a drop down with the list of layer presets.\n\n## Parameters  \npresets (optional)  \nArray of presets in the format  \n[{  \n\"name\": \"name of the preset\",\n\"value\": \"//layer-preset/af0eaa24-1f34-4085-8c22-33b0968f0e50\"  \n}]  \n### Note: Ensure to drop off the \"item:\" portion of the value.  If you send that in you will actually get the object for the preset that is not usable.  We append \"item:\" on when changing the preset\n","id":75,"inputs":{},"position":"-580,-10","title":"Notes"},{"action":"gcx:wf:core::If","description":"if presets sent in","id":76,"inputs":{"condition":{"accessors":["$gwfi","$gwfi"],"annotations":[{"count":5,"index":0,"kind":"idref"},{"count":5,"index":32,"kind":"idref"}],"code":"$gwfi.inputs.presets != null && $gwfi.inputs.presets.length > 0","source":"$gwfi.inputs.presets != null && $gwfi.inputs.presets.length > 0"}},"position":"-30,200","title":"If","transitions":[{"branch":"false","id":68,"inputs":{},"position":"210,245 340,245 340,460","sourceConnector":"right","target":{"id":63},"targetConnector":"top"},{"branch":"true","id":77,"inputs":{},"position":"-30,245 -150,245 -150,330","sourceConnector":"left","target":{"id":40},"targetConnector":"top"}]}]},{"id":18,"steps":[{"id":19,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":31,"inputs":{},"position":"90,60 90,110","sourceConnector":"bottom","target":{"id":21}}]},{"action":"gcx:wf:forms::GetFormElementItemsFromCollection","id":21,"inputs":{"collection":{"accessors":["$gwfi"],"annotations":[{"count":5,"index":0,"kind":"idref"}],"code":"$gwfi.inputs.presets","source":"$gwfi.inputs.presets"},"labelFieldName":"name","valueFieldName":"value"},"name":"formElementItems1","position":"-30,110","title":"Get Form Element Items From Collection","transitions":[{"id":30,"inputs":{},"position":"90,170 90,220","target":{"id":29}}]},{"action":"gcx:wf:forms::SetFormElementItems","id":29,"inputs":{"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"items":{"accessors":["$formElementItems1"],"annotations":[{"count":18,"index":0,"kind":"idref"}],"code":"$formElementItems1.items","source":"$formElementItems1.items"}},"position":"-30,220","title":"Set Form Element Items"}],"title":"populate-ddlPresetList"},{"id":32,"steps":[{"id":33,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":37,"inputs":{},"position":"90,60 90,110","target":{"id":36}}]},{"action":"gcx:wf:core::Annotation","description":"If you still want other form elements to be able to depend on this Drop Down List, you must also execute the *Propagate Form Event* activity here. Otherwise its dependents will not populate in response to this change event.","id":35,"inputs":{},"position":"-320,0","title":"Tip"},{"action":"gcx:wf:forms::GetFormElementValue","id":36,"inputs":{"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"}},"name":"formElementValue1","position":"-30,110","title":"Get Form Element Value","transitions":[{"id":39,"inputs":{},"position":"90,170 90,220","target":{"id":38}}]},{"action":"gcx:wf:app::RunCommand","id":38,"inputs":{"commandName":"map.apply-layer-preset","commandParameter":{"accessors":["$formElementValue1"],"annotations":[{"count":18,"index":26,"kind":"idref"}],"code":"{ \"layerPreset\": \"item:\" + $formElementValue1.value }","source":"{\"layerPreset\": \"item:\" + $formElementValue1.value}"}},"position":"-30,220","title":"Run Command"}],"title":"change-ddlPresetList"},{"id":49,"steps":[{"id":50,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":67,"inputs":{},"position":"90,60 90,100","target":{"id":66}}]},{"action":"gcx:wf:app::RunCommand","description":"Change the preset to the selected.","id":54,"inputs":{"commandName":"map.apply-layer-preset","commandParameter":{"accessors":["$gfevCurrentPreset"],"annotations":[{"count":18,"index":26,"kind":"idref"}],"code":"{ \"layerPreset\": \"item:\" + $gfevCurrentPreset.value }","source":"{\"layerPreset\": \"item:\" + $gfevCurrentPreset.value}"}},"position":"170,580","title":"Run Command"},{"action":"gcx:wf:forms::GetFormElementValue","description":"Get the current preset","id":56,"inputs":{"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"}},"name":"gfevCurrentPreset","position":"170,440","title":"Get Form Element Value","transitions":[{"id":58,"inputs":{},"position":"290,530 290,580","target":{"id":54}}]},{"action":"gcx:wf:forms::SetCurrentFormElementItem","description":"Set to querystring preset","id":62,"inputs":{"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"matchType":"label","value":{"accessors":["$appUrl"],"annotations":[{"count":7,"index":0,"kind":"idref"}],"code":"$appUrl.query.preset","source":"$appUrl.query.preset"}},"name":"scfeiQueryStringPreset","position":"-230,310","title":"Set Current Form Element Item","transitions":[{"id":70,"inputs":{},"position":"-110,400 -110,485 170,485","sourceConnector":"bottom","target":{"id":56},"targetConnector":"left"}]},{"action":"gcx:wf:core::If","description":"if preset is set in the querystring","id":66,"inputs":{"condition":{"accessors":["$appUrl","$appUrl"],"annotations":[{"count":7,"index":0,"kind":"idref"},{"count":7,"index":32,"kind":"idref"}],"code":"$appUrl.query.preset != null && $appUrl.query.preset != \"\"","source":"$appUrl.query.preset != null && $appUrl.query.preset != \"\""}},"position":"-30,100","title":"If","transitions":[{"branch":"true","id":69,"inputs":{},"position":"-30,145 -110,145 -110,310","sourceConnector":"left","target":{"id":62},"targetConnector":"top"},{"branch":"false","id":73,"inputs":{},"position":"210,145 550,145 550,190","sourceConnector":"right","target":{"id":71},"targetConnector":"top"}]},{"action":"gcx:wf:core::If","description":"If a default is set","id":71,"inputs":{"condition":{"accessors":["$gwfi"],"annotations":[{"count":5,"index":0,"kind":"idref"}],"code":"$gwfi.inputs.presets.filter(x => x.default).length > 0","source":"$gwfi.inputs.presets.filter(x=>x.default).length > 0 "}},"position":"430,190","title":"If","transitions":[{"branch":"true","id":78,"inputs":{},"position":"430,235 290,235 290,300","target":{"id":83},"targetConnector":"top"},{"branch":"false","id":86,"inputs":{},"position":"670,235 790,235 790,300","sourceConnector":"right","target":{"id":72},"targetConnector":"top"}]},{"action":"gcx:wf:forms::SetCurrentFormElementItem","description":"Set to first preset","id":72,"inputs":{"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"matchType":"index","value":0},"name":"scfeiFirst","position":"670,300","title":"Set Current Form Element Item","transitions":[{"id":74,"inputs":{},"position":"790,390 790,485 410,485","sourceConnector":"bottom","target":{"id":56},"targetConnector":"right"}]},{"action":"gcx:wf:forms::SetCurrentFormElementItem","description":"Set to default","id":83,"inputs":{"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"matchType":"label","value":{"accessors":["$gwfi"],"annotations":[{"count":5,"index":0,"kind":"idref"}],"code":"$gwfi.inputs.presets.filter(x => x.default)[0].name","source":"$gwfi.inputs.presets.filter(x=>x.default)[0].name"}},"name":"scfeiFirst1","position":"170,300","title":"Set Current Form Element Item","transitions":[{"id":85,"inputs":{},"position":"290,390 290,440","sourceConnector":"bottom","target":{"id":56},"targetConnector":"top"}]}],"title":"load-ddlPresetList"}],"deploymentConfig":{"supportedApps":{"VSW":true}},"designerVersion":"5.46.1+1","forms":[{"defaults":{},"elements":{"ddlPresetList":{"enabled":true,"index":0,"items":{},"rowIndex":0,"rowNumber":0,"title":{"markdown":""},"type":"DropDownList"},"footer":{"enabled":true,"items":{"0":{"default":true,"index":0,"label":{"markdown":"Submit"},"validates":true,"value":"submit"},"1":{"index":1,"label":{"markdown":"Cancel"},"validates":false,"value":"cancel"}},"section":"footer","type":"ButtonBar","visible":false},"header":{"section":"header","title":{"markdown":""},"type":"Header"}},"id":5}],"licenseInfo":{"licenseUrl":"https://devgis.saskatoon.ca/lapp/Geocortex/Workflow/service/auth/license"},"start":{"id":3},"transitions":[{"branch":"populate$ddlPresetList","id":20,"inputs":{},"source":{"id":4},"target":{"id":19}},{"branch":"changed$ddlPresetList","id":34,"inputs":{},"source":{"id":4},"target":{"id":33}},{"branch":"load$ddlPresetList","id":51,"inputs":{},"source":{"id":4},"target":{"id":50}}]}

    You can add a querystring parameter 
    preset=presetname

    NOTE: Just know this parameter can't be tested from the Web designer for some reason…..really doesn't like querystring parameters - maybe there is a way, just not aware of it.

    Example of the parameters:
    NOTE: leave “item:” off the preset value (this is the preset object path).  If you send it in it with item: it won't be accessible….we add it on in the workflow later when setting the preset.

    {
        "presets": [
            {
                "name": "Aerial Photo Locator",
                "value": "//layer-preset/36a9c691-b403-43d1-a9a3-9dd6a92e2fdd",
                "default": "true"
            },
            {
                "name": "Document Retrieval",
                "value": "//layer-preset/2c099530-0ec7-425b-ac0e-2519d6cb26a8"
            },
            {
                "name": "Parks",
                "value": "//layer-preset/c5a8f4a5-e52b-4097-802f-1a287fbaaa5e"
            }
        ]
    }

    We just added a Workflow item into the Layers Row above the Layers List

    And set Layer Presets visibility to Hidden

     

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.