Spectrum Spatial (SSA/LIM)

Expand all | Collapse all

Convert v12 Infotemplate to v2018 and then v2019

Jump to Best Answer
  • 1.  Convert v12 Infotemplate to v2018 and then v2019

    Posted 05-20-2020 04:53
    Edited by George Corea 05-20-2020 04:54
      |   view attached
    I had a infotemplate in v12 that used to filter the columns to display and didn't show any that had a value of 'F'. How can I do the same in v2018?

    in v12
    <!--//use below for custom template impln-->
    <!--<ul data-ng-repeat="(key, prop) in feature.allOthers">
    <li ng-show="key.toUpperCase() !== 'STRATUSID'"><strong>{{key}}</strong>: {{prop}}</li>
    </ul>-->
    <!-- Display all the columns except the key column MI_PRINX --><ul>
    <div ng-repeat="columnname in notSorted(feature.featureAttributes) | filter : '!stratusid'" ng-if="feature[columnname].value != '' && feature[columnname].value != 'F'";>
    <strong>{{feature[columnname].name}}: </strong><span>{{feature[columnname].value}}</span>
    </div>

    I have attached the infotemplate that is created in v2018 as in the past I have been able to change the .html created in v2018 to what used in v12 by doing the following

    so if I had the following in v12
    <b><a href="http://globe.information.qld.gov.au/cgi-bin/SmartMapgen.py?q={{feature.Lot_num.value}}\{{feature.Plan_num.value}}" target="_blank">Open SMIS Map</b>

    In v2018 I changed this to
    <b><a href="http://globe.information.qld.gov.au/cgi-bin/SmartMapgen.py?q={{data.feature.Lot_num.value}}" target="_blank">Open SMIS Map</a></b>

    so... {feature} becomes {data.feature} but this didn't work.

    As there are a lot of fields I don't want to have to specify each column .

    Template_Planning_Layer_Summary_v12.html is the version that used to work
    ParcelLayers.* - are the files just created in v2018 and shows all the column names.

    ------------------------------
    George Corea
    Mangoesmapping
    ------------------------------

    Attachment(s)

    zip
    ParcelLayers.html.zip   4K 1 version


  • 2.  RE: Convert v12 Infotemplate to v2018 and then v2019

    Posted 05-24-2020 17:57
    Hi George,

    There is a checkbox in Template Designer to hide fields with NULL Values, it adds this component "isHideNull": true against each attribute listed in the TS & JSON files.

    You can probably tackle this with Notepad++ and a careful Find&Replace.

    Cheers,

    Will

    ------------------------------
    William Dean
    Cairns Regional Council
    ------------------------------



  • 3.  RE: Convert v12 Infotemplate to v2018 and then v2019

    Posted 05-28-2020 17:35
    Thanks Will - the issue is that the field is not null -it has a 'F' in it. I can replace all the 'F' values with null in the .tab file but there should be a way of dealing with this in code.

    The key is in changing
    <div ng-repeat="columnname in notSorted(feature.featureAttributes) | filter : '!stratusid'" ng-if="feature[columnname].value != '' && feature[columnname].value != 'F'";>

    In the 2018/19 versions of SSA feature. becomes data.feature.

    But there must be a difference in the way the columns are called as now as in the html it's
    <pb-info-column [columnConfig]="Row_IDConfig" [feature]="data.feature" class="multilabelrow col-xs-12 default-topbtm-padding">
    </pb-info-column>

    As per https://docs.angularjs.org/api/ng/directive/ngRepeat the ng-repeat needs whatever columnnameis now called.

    ------------------------------
    George Corea
    Mangoesmapping
    ------------------------------



  • 4.  RE: Convert v12 Infotemplate to v2018 and then v2019

    Employee
    Posted 06-08-2020 15:30
    Edited by Juned Ahmad 06-08-2020 15:31
    Hi George,
    There is no any option in template designer to exclude column that have value 'F' howver we can exclude all column that have null or blank value via template designer as William already suggested

    but yes we can achieve this via template edit outside TD in notepad or any editor.

    Please refer below suggesstion

    1. <pb-info-column *ngIf="data.feature[Row_IDConfig.name].value !=='F'" [columnConfig]="Row_IDConfig" [feature]="data.feature" class="multilabelrow col-xs-12 default-topbtm-padding"></pb-info-column>


    and i hope anchor tag will also work if you do something as mention below in 18.2 templates
         2.<b><a [href]="'http://globe.information.qld.gov.au/cgi-bin/SmartMapgen.py?q='+ data.feature.Lot_num.value"           target="new">Open SMIS Map</a></b>


    Please let me know if this solve the purpose.

    Thanks

    ------------------------------
    Juned Ahmad
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 5.  RE: Convert v12 Infotemplate to v2018 and then v2019

    Posted 06-08-2020 18:33
    Thanks Juned.

    This seems to work to not show data in a column if it's F but you then have to have this for every column in the table. This implementation has over a hundred columns so it's not ideal.

    The original code only had one line to show all columns where the value in it was not F as it evaluated the column and only showed it if it wasn't 'F'

    So how would you re-write this to use ng-repeat? the key question is what is 'columnname' in the current implementation of SSA?

    <div ng-repeat="columnname in notSorted(feature.featureAttributes) | filter : '!stratusid'" ng-if="feature[columnname].value != '' && feature[columnname].value != 'F'";>
    <strong>{{feature[columnname].name}}: </strong><span>{{feature[columnname].value}}</span>
    </div>

    ------------------------------
    George Corea
    Mangoesmapping
    ------------------------------



  • 6.  RE: Convert v12 Infotemplate to v2018 and then v2019

    Employee
    Posted 06-09-2020 00:44
    Edited by Juned Ahmad 06-09-2020 00:48
    Hi George,
    please refer below comments if it help !

    ng-repeat is older way to iterate over a list and we cannot do this in 18.2 .
    so in 18.2 we are adding a column component whenever we add column element in template designer while creating templates.

    As you can refer ur shared ParcelLayers.ts, there are 124 column component has been added in template(ParcelLayers.html), see below
     <pb-info-column [columnConfig]="Row_IDConfig" [feature]="data.feature" class="multilabelrow col-xs-12 default-topbtm-padding">  </pb-info-column>
    <pb-info-column [columnConfig]="LotplanConfig" [feature]="data.feature" class="multilabelrow col-xs-12 default-topbtm-padding">  </pb-info-column> 
    <pb-info-column [columnConfig]="Prop_NoConfig" [feature]="data.feature" class="multilabelrow col-xs-12 default-topbtm-padding"> </pb-info-column>
    etc..

    so instead of modifying at each 124 places in template(ParcelLayers.html) we can update at single single place in file  column.component.ts under location ur_installed_ssa_dir\customerconfigurations\analyst\theme\templatecomponents

    find
    if(this.hide){if(this.hide){ this.elementRef.nativeElement.remove(); }
    replace with
    if(this.hide || this.value ==='F'){ this.elementRef.nativeElement.remove(); }

    it will work for all the columns in your template and please do remember it will also affect all other templates as well and will remove column component whenever we have value 'F'.

    How to get column name in custom template please refer your shared ParcelLayers.ts,there are 124 objects has been added for each column in ParcelLayers.ts
     example
    readonly Acid_HighConfig = {
          "name": "Acid_High", // column name so u can get column name by doing Acid_HighConfig.name
          "type": "String",
          "selected": true,
          "elementType": "Column",
          "showLabel": true,
          "showIcon": false,
         "labelPosition": "inline"
    };

    similarly we have other column object config in ParcelLayers.ts

    e.g  ur_column_name=TZICBPConfig.name or ur_column_name =EGES_100Config.name

    Thanks

    ------------------------------
    Juned Ahmad
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 7.  RE: Convert v12 Infotemplate to v2018 and then v2019

    Posted 06-09-2020 04:09
    Thanks....

    In the column.component.ts file did you mean this line?

    Can you send me a copy of your .ts and html etc files if you tested this? Do I need to make changes to the files in /infotemplates or just in the above .ts?

    Regards,

    ------------------------------
    George Corea
    Mangoesmapping
    ------------------------------



  • 8.  RE: Convert v12 Infotemplate to v2018 and then v2019
    Best Answer

    Employee
    Posted 06-09-2020 04:26
    Edited by Juned Ahmad 06-09-2020 17:47
    Yes , you can update if condition with extra check if value have "F" then remove it.
    if(this.hide || this.value ==='F'){
        this.elementRef.nativeElement.remove();
    }

    I am not able to test it as i dont have environment set up.

    ------------------------------
    Juned Ahmad
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 9.  RE: Convert v12 Infotemplate to v2018 and then v2019

    Posted 06-09-2020 17:37
    Edited by George Corea 06-09-2020 19:19
    Thanks Juned. Just the change in the column.component.ts works great - no changes were required in the infotemplates themselves.

    I changed the code a bit below so that it doesn't show any columns with no value or just a space as well. It maybe good for you to consider including this in the supplied code, maybe without the F value as it will make the info shown cleaner and also then users won't need to labouriously specify each column and tick not to show null as I would think that most people don't want to show columns with no value in it, so it should be the default case.

    if(this.hide || this.value ==='F' || this.value === '' || this.value===' ')
    { this.elementRef.nativeElement.remove();
    }


    ------------------------------
    George Corea
    Mangoesmapping
    ------------------------------