Skip to Content
avatar image
Former Member

geomap of sap design studio

Hi, everybody.

I have create a project,I've used geomap,and I'll use it to drill down,eg: country to province,province to city,and then I'll have a button to return above level,eg:city to province,province to county. Everything works fine,and I realized it. But I've meet the problem is that when I click country to drill down province,and then click return button back to country,at moment time,if I click the same coutry to dril down againl ,I'll get null value,if I click different country,I will get the true value.Is this a bug?How can I avoid it?

Waiting for your help.

Thanks.

Jing

Add comment
10|10000 characters needed characters exceeded

  • Former Member Mustafa Bensan

    "On Select" event of map:

    if(glevel==1){
    //华东华南大区
    var val=GEO_MAP_1.getSelectedMember("区域").text;
    DS_5.setFilter("区域", val);
    DS_5.removeDimension("区域");
    DS_5.moveDimensionToRows("省");
    DS_1.setFilter("区域", val);
    DS_1.removeDimension("区域");
    DS_1.moveDimensionToRows("省");
    glevel=2;
    PANEL_1.setVisible(true);
    }else if(glevel==2){
    //省
    val=GEO_MAP_1.getSelectedMember("省").text;
    DS_5.setFilter("省", val);
    DS_5.removeDimension("省");
    DS_5.moveDimensionToRows("市");
    DS_1.setFilter("省", val);
    DS_1.removeDimension("省");
    DS_1.moveDimensionToRows("市");
    glevel=3;
    }
    APPLICATION.alert(val);

    "On Click" event of button:

    if(glevel==3){
    //市-省
    DS_5.clearFilter("省");
    DS_5.removeDimension("市");
    DS_5.moveDimensionToRows("省");
    DS_1.clearFilter("省");
    DS_1.removeDimension("市");
    DS_1.moveDimensionToRows("省");
    glevel=2;
    }else if(glevel==2){
    //省-区域
    DS_5.clearFilter("区域");
    DS_5.removeDimension("省");
    DS_5.moveDimensionToRows("区域");
    DS_1.clearFilter("区域");
    DS_1.removeDimension("省");
    DS_1.moveDimensionToRows("区域");
    glevel=1;
    PANEL_1.setVisible(false);
    }

    Additional of map layer:

    1gs.png (21.7 kB)
  • Thanks for the further details. So in this case, you are using just one map layer, where the marker does not have latitude and longitude, so the marker is simply centred on the country or province? And what about for the city location?

    By the way, what is the purpose of datasource DS_1?

  • Former Member Mustafa Bensan

    Hi Mustafa.

    I'm sorry I've upload wrong picture,following picture was what I used.I just want to get the demission value when I click map.

    The DS_1 was the datasource of a crosstable,I just use it to watch the detail value.Everytime I drill down or turn back,I will use

    moveDimensionToRows and removeDimension function to realize change demission,so I can change the city level to show.

    Thanks.

    Jing

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 11, 2017 at 06:30 AM

    Hi Jing Zhang,

    I think there is no direct way to clear selection, you have to write a logic to overcome the situation as below.

    if (GEO_MAP_1.getSelectedMember(dimension)!="")

    {

    DS_1.setFilter(dimension, GEO_MAP_1.getSelectedMember(dimension));

    "All the setfilter codes here"

    }

    Then rest of your codes here...


    So you can skip the error by this method.

    let me know if you need any help on this.

    Thanks,

    Poovarasan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Poovarasan.

      What you said can help me avoid null value.But when I click blank area,it will still work with last time value.And you can look the follow floor of Mustafa,maby you will have some idea.

      Thanks.

      Jing

  • May 11, 2017 at 12:43 PM

    Hi Jing,

    In order to effectively simulate and act upon a double-click you will need to use the Timer component. Here is what I suggest for your scenario, taking into account the issue of consecutively selecting the same Country or Province:

    1. Create a Global Script Variable of type int named clickCount with a default value of 0;

    2. Create a Global Script Variable of type String named currentCountry with no default value;

    3. Create a Global Script Variable of type String named currentProvince with no default value;

    4. In the Technical Components section of your application create a Timer component;

    5. Set the Interval in Milliseconds property of the Timer component to 500. You can experiment with values from 100 to 900 to apply your ideal click speed;

    6. Create a Global Script Function named processSingleClick and MOVE your Map "On Select" script code to this function, with the updates shown below:

    if(glevel==1){
    //华东华南大区
    var val=GEO_MAP_1.getSelectedMember("区域").internalKey;
    if (val != "ALL_MEMBERS") {
      currentCountry = val;
    }
    
    DS_5.setFilter("区域", val);
    //DS_5.removeDimension("区域");
    //DS_5.moveDimensionToRows("省");
    DS_5.swapDimensions("区域", "省");
    
    DS_1.setFilter("区域", val);
    //DS_1.removeDimension("区域");
    //DS_1.moveDimensionToRows("省");
    DS_1.swapDimensions("区域", "省");
    
    glevel=2;
    PANEL_1.setVisible(true);
    
    }else if(glevel==2){
    //省
    val=GEO_MAP_1.getSelectedMember("省").internalKey;
    if (val != "ALL_MEMBERS") {
      currentProvince = val;
    }
    
    DS_5.setFilter("省", val);
    //DS_5.removeDimension("省");
    //DS_5.moveDimensionToRows("市");
    DS_5.swapDimensions("省", "市");
    
    DS_1.setFilter("省", val);
    //DS_1.removeDimension("省");
    //DS_1.moveDimensionToRows("市");
    DS_1.swapDimensions("省", "市");
    
    glevel=3;
    }
    
    

    Note: I have replaced the combination of removeDimension()/moveDimensionToRows() with swapDimensions() for efficiency of coding improved readability. I have also used the internal key of the selected member instead of the text.

    7. Add a Popup component to your application and compose the content as per requirements. This will serve as the popup message for the double click;

    8. Create a Global Script Function named processDoubleClick and include the following code:

    POPUP_1.open();

    9. Add the following code to the "On Select" even script of your Map component:

    if (TIMER_1.isRunning()) {
    	clickCount = 2;	
    } else {	
    	clickCount = 1;
    	TIMER_1.start();
    	}
    

    10. Add the following code to the "On Timer" event script of your Timer component:

    if (TIMER_1.isRunning()) {
    	clickCount = 2;	
    } else {
    	clickCount = 1;
    	TIMER_1.start();
    }
    me.stop();
    

    Let me know how you go.

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jing,

      Re: "And about you said above code,can you tell me where do you set value for gdistrict , it seens the gdistrict value nerver changed.In face, the gdistrict value will changed when geomap click value isn't null."

      That is correct, the gdistrict value is only updated when the geo map click value IS NOT null. This ensures that when a null click occurs, the most recent valid gdistrict selection is "remembered", thereby avoiding showing all locations on de-select from clicking same area twice in a succession. It should work as desired if you apply the code as I have specified originally.

      Regards,

      Mustafa.