Skip to Content
0

geomap of sap design studio

May 10, 2017 at 03:48 AM

455

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded

Hi Jing,

Can you post some screenshots and the script code you are using to drill down and up? I don't recall encountering your issue when preparing my geomap drill-down example:

https://blogs.sap.com/2015/06/26/design-studio-innovation-series-topic-7-geo-maps-part-ii-zoom-zoom-zoom/

Regards,

Mustafa.

0
Former Member
Mustafa Bensan

First,select “华北区”,drill down to province

Second.on province page,click return button,back to first page. But if I click “华北区” again,I will get value null.

If I click other value,it will ok

1.png (216.4 kB)
2.png (222.5 kB)
3.png (82.0 kB)
0

Thanks for the screenshots. To attempt to replicate your issue we really need the following additional information:

1). The script code in the "On Select" event of the map

2) The script code in the "On Click" event of your Back button

3) The Additional Property Sheet screenshots for your map layers.

Regards,

Mustafa.

0
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)
0

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?

0
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

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

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

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Poovarasan.

I'm glad you can reply me.

I had tried what you said before.Even though it can drill down will value,but I must click twice.

In my application, I want to realize this function:

if I click onece time,map will drill down; if I click double in a monent,it will popup detail message.

If I use what you said ,I will need click double to drill down,and how can I realzie popup detail message?

Thanks.

Jing

0
Former Member
Former Member

Hi Jing Zhang,

In that case you can store the value in a variable in your application and compare it with the filter value of the datasource, instead of compairing with null.

var a = GEO_MAP_1.getSelectedMember(dimension);

if (GEO_MAP_1.getSelectedMember(dimension) != DS_1.getfilterExt(dimension))

{

Your code for single click..

}

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

{

Your code for double click..

}

It will work mostly.

Thanks,

Poovarasan

0
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

0
Mustafa Bensan May 11, 2017 at 12:43 PM
0

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.

Show 9 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Mustafa.

On this issue we thought as one.But I have set some change base yours.

Do you have founded? when we double click map,the map will expand ,so the thought of single click drilldown,double click to skip not reasonable. I change double click will drilldown,single click will skip.My code followed.

1.Map code

if(TIMER_1.isRunning()){
//double,报表下钻
gclickcount=2;
TIMER_1.stop();
GLOBAL_SCRIPTS_1.gfunction_drilldown();
}else{
//single,跳转webi
gclickcount=1;
TIMER_1.start();
}

2.Timer code

APPLICATION.openNewWindow("/BOE/OpenDocument/opendoc/openDocument.jsp?iDocID=FlATFVmi6QoAnA8AAAB3gFgAAgMsnZOi&sIDType=CUID&sRefresh=Y&lsS输入以下各项的值 地域=華北");
TIMER_1.stop();

I was set Timer 1000ms.If I click double in 1s,I will skip to webi,else drilldown.It's very good.

But we go back to origion,when we click a value twice,the sencond time we will get null.Reference to Poovarasan said in above floor,if we use global variable,when the value is null,we use last time value to instant it,it seens can work fine.

But if we click blank area,it will also action as I click the last time value.

With those doubt,How can I resolve it?

Thanks.

Jing

0

Hi Jing,

Yes, I did notice the zooming on double-click issue. I also realised I accidentally duplicated my code instructions above. Can you try changing your code as follows?:

1. Map Code

if(TIMER_1.isRunning()){
//double,报表下钻

gclickcount=2;

}else{
//single,跳转webi

gclickcount=1;
TIMER_1.start();

}

2. Timer Code

me.stop();

if (clickCount == 1) {
	//single,跳转webi
	APPLICATION.openNewWindow("/BOE/OpenDocument/opendoc/openDocument.jsp?iDocID=FlATFVmi6QoAnA8AAAB3gFgAAgMsnZOi&sIDType=CUID&sRefresh=Y&lsS输入以下各项的值 地域=華北");
	
} else 

if (clickCount == 2 ){
	//double,报表下钻
	GLOBAL_SCRIPTS_1.gfunction_drilldown();
	
}

clickCount = 0;
0

Also, can you post the code you have in your GLOBAL_SCRIPTS_1.gfunction_drilldown() ?

0
Former Member
Mustafa Bensan

Hi Mustafa.

In your Map code,when double click ,we will can't trigger the Timer event.So we will can't realize double event in Timer .

if(TIMER_1.isRunning()){
//double,报表下钻

gclickcount=2;

}

Follow is my code of GLOBAL_SCRIPTS_1.gfunction_drilldown()

if(glevel==1){
//华东华南大区
var val=GEO_MAP_1.getSelectedMember("_yNAX4CsjEeezO7mTeuhe_Q").text;
if(val==""){
//如果值为空,那么将上次选择的值存入,gdistrict是区域
val=gdistrict;
}
DS_2.setFilter("区域", val);
DS_2.removeDimension("区域");
DS_2.moveDimensionToRows("省");
DS_1.setFilter("区域", val);
DS_1.removeDimension("区域");
DS_1.moveDimensionToRows("省");
glevel=2;
PANEL_1.setVisible(true);
}else if(glevel==2){
//省,gprovince是省
val=GEO_MAP_1.getSelectedMember("省").text;
if(val==""){
val=gprovince;
}
DS_2.setFilter("省", val);
DS_2.removeDimension("省");
DS_2.moveDimensionToRows("市");
DS_1.setFilter("省", val);
DS_1.removeDimension("省");
DS_1.moveDimensionToRows("市");
glevel=3;
}
0

Hi Jing,

On further review, please try making the following code updates, EXACTLY as specified below:

1. "On Select" event script of Map:

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

2. "On Timer" event script of Timer:

me.stop();

if (gclickCount == 1) {
	//single,跳转webi
	APPLICATION.openNewWindow("/BOE/OpenDocument/opendoc/openDocument.jsp?iDocID=FlATFVmi6QoAnA8AAAB3gFgAAgMsnZOi&sIDType=CUID&sRefresh=Y&lsS输入以下各项的值 地域=華北");
	
} else 

if (gclickCount == 2 ){
	//double,报表下钻
	GLOBAL_SCRIPTS_1.gfunction_drilldown();
	
}

gclickCount = 0;

3. Global Script Function code for GLOBAL_SCRIPTS_1.gfunction_drilldown():

if(glevel==1){
//华东华南大区
var val=GEO_MAP_1.getSelectedMember("_yNAX4CsjEeezO7mTeuhe_Q").text;
if(val != ""){
//如果值为空,那么将上次选择的值存入,gdistrict是区域
gdistrict = val;
}
DS_2.setFilter("区域", gdistrict);
DS_2.removeDimension("区域");
DS_2.moveDimensionToRows("省");
DS_1.setFilter("区域", val);
DS_1.removeDimension("区域");
DS_1.moveDimensionToRows("省");
glevel=2;
PANEL_1.setVisible(true);
}else if(glevel==2){
//省,gprovince是省
val=GEO_MAP_1.getSelectedMember("省").text;
if(val != ""){
gprovince = val;
}
DS_2.setFilter("省", gprovince);
DS_2.removeDimension("省");
DS_2.moveDimensionToRows("市");
DS_1.setFilter("省", val);
DS_1.removeDimension("省");
DS_1.moveDimensionToRows("市");
glevel=3;
}

Let me know how the above approach goes.

Regards,

Mustafa.

0
Former Member
Mustafa Bensan

Hi Mustafa.

Even though it still haven't resolve the question that click value is null,but double problem have solved.

And are you sure ,in your code TIMER_1.stop() have work?

TIMER_1.stop()
APPLICATION.alert("1");

I set this code in my TIMER event,which should stop when time is coming,but it still work again and again.Is this a bug?

Thanks.

Jing

0

Hi Jing,

Regarding the "still haven't resolved the click value is null" issue, are you sure you have implemented the code changes exactly as I have specified? For example changing:

From

if(glevel==1){
//华东华南大区
var val=GEO_MAP_1.getSelectedMember("_yNAX4CsjEeezO7mTeuhe_Q").text;
if(val==""){
//如果值为空,那么将上次选择的值存入,gdistrict是区域
val=gdistrict;
}
DS_2.setFilter("区域", val);

To

if(glevel==1){
//华东华南大区
var val=GEO_MAP_1.getSelectedMember("_yNAX4CsjEeezO7mTeuhe_Q").text;
if(val != ""){
//如果值为空,那么将上次选择的值存入,gdistrict是区域
gdistrict = val;
}
DS_2.setFilter("区域", gdistrict);

And the same for all other levels.

About the TIMER_1.stop() in the "On Timer" event, you are right, after testing I see that the timer does continue for a few more iterations but eventually stops completely. This is unusual behaviour that might be related to script execution synchronisation with the timer event itself but in any case, the differentiation between click and double-click still works as required.

Regards,

Mustafa.

0
Show more comments

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.

0