Skip to Content
0

How to get the dimension name of the second dimension?

May 08, 2017 at 06:24 AM

99

avatar image

Dear community

I am developing a dashboard that contains a query which includes a couple of dimensions (and of course measures). The first column is the dimension which gives me the sorted order of the second dimension/column. The reason for that is that we cannot sort the keys of the second dimension. So the first column/dimension contains numbers from 1 to 10. The second contains titles (words). When I add this query to a crosstab it shows me the right order when I add the first and the second column.

But what I actually have to do is to get the names/titles of the second dimension into graphomate tiles (title) (or in an array as another option) in the right order. At the moment, the design studio takes the second column (titles) in the alphabetic order.

Has somebody an idea to fix this issue?

Glad for every help.

10 |10000 characters needed characters left characters exceeded

Hi Roman - would it be possible to post some screen shots? I'm having a hard time following; I think if you share screen shots the community will have a better chance to assist.

0

Hi Tammy

Mustafa described it absolutely right and this exatcly my point/issue. So I have tried the Data Iterator but I get the error messages below.

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

1 Answer

Mustafa Bensan May 08, 2017 at 02:31 PM
0

Hi Roman,

Based on your scenario, I am guessing that you are probably trying to retrieve the dimension member names/titles using the data source getMembers() method. If that is the case, this is a known limitation whereby getMembers() does not return member values in the same order as the data result set but rather in master data order, which is usually alphabetical, as you have experienced.

You can use the Community Design Studio SDK Data Iterator component to loop through the data result set in the correct sort order and obtain the required names/titles that way.

Regards,

Mustafa.

Show 11 Share
10 |10000 characters needed characters left characters exceeded

Hi Mustafa

Thank you so much for your support. I tried to implement that but I get the error message:

Message: org.mozilla.javascript.EcmaError: SyntaxError: Empty JSON string (flatten#12)

Stack trace: com.sap.ip.bi.zen.rt.framework.jsengine.JsEngineException: org.mozilla.javascript.EcmaError: SyntaxError: Empty JSON string (flatten#12)

And

Error during script processing: "START_FUNCTIONS.on_startup();" "com.sap.ip.bi.zen.rt.framework.jsengine.JsEngineException: org.mozilla.javascript.EcmaError: SyntaxError: Empty JSON string (flatten#12)

The example code I have implemented is the following:

var dim = DATAITERATOR_1.getDimensions();

var text = "";

dim.forEach(function(element, index) {

text = text + element.text;

});

TEXT_1.setText(text);

And I only run it locally (until it works).

Do you have any idea why?

0

Hi Roman,

I have just tried your exact script code against a BEx data source using DS 1.6 SP3 and it worked perfectly fine for me. This could be an issue related to your installation/environment.

Some questions:

1) What type of data source are you using?

2) What version of Design Studio are your running?

3) Can you provide screenshots of:

(a) Your data source Initial View screen

(b) The Properties panel of your Data Iterator component.

Thanks,

Mustafa.

0

By the way, which part of your application are you executing your script code?

0

Okay, I think I know what the issue might be. You are probably trying to execute the script in the "On Startup" event of the application, which doesn't wait for the data source to finish loading. If that is where you have your script, I suggest you move it to the "On Data Change" event of the Data Iterator component.

0

Hi Roman - you could ask the question on GitHub about the data iterator error

0

Mustafa, you are absolutely right. Now it works. It was just because I had an event in the "On Startup".

Do you probably know in which SDK package the data iterator is? Cannot find it on this link

http://org-scn-design-studio-community.github.io/sdkinstall/web/components/

Utils, shared, data bound, ...?

Thanks a lot for your help!!!

1

It is technically under Utilities, however the documentation on that page you reference isn't updated that often anymore. I wrote the Data Iterator component though and post a blog entry on it that may give you more information.

https://blogs.sap.com/2016/02/08/design-studio-16-sdk-data-iterator-read-your-data-row-by-row-finally/

I'm glad to answer any how-to questions you may have, though. If you feel it's a bug in the component, best to add it to the pile in GitHub though.

1

Thanks for your reply. Will you fix the bug? What is it about?

0

Hi Roman,

Which bug are you referring to? I thought in your earlier reply you indicated that the component is working fine after moving the code as I suggested?

Regards,

Mustafa.

1

OMG, I am sorry. I interpreted the sentence of Mike in a wrong way :).Thanks for your help!

0

No worries. It happens to me all the time and it's usually my fault :)

1