cancel
Showing results for 
Search instead for 
Did you mean: 

Date dimension not displayed correctly

shilpa_banerjee
Explorer
0 Kudos

I have a date dimension in my model and need to display it as a dropdown.I have used the following code to get the members and display the data. But my dropdown looks weird. date-issue.pngSee attached. How can I see dates in the dropdown and not formats.Looks like I am doing something wrong in date format. Any guidance would be helpful.

var dates = Tbl_MarketPrice.getDataSource().getMembers("Date",10);

var l = 0; console.log(dates);

for(l=0;l<dates.length;l++)

{

DD_Date.addItem(dates[l].id);

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Susanne_Helbig
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear shilpa.banerjee,

your dropdown is only showing the IDs of your Date members.

You need to write your code like follows to show the description:

var dates = Tbl_MarketPrice.getDataSource().getMembers("Date",10);
var l = 0; console.log(dates);
for(l=0;l<dates.length;l++)
{
DD_Date.addItem(dates[l].id, dates[l].description);
}

Best regards

Susanne

shilpa_banerjee
Explorer
0 Kudos

This is still not working after changing the code.

Susanne_Helbig
Product and Topic Expert
Product and Topic Expert
0 Kudos

Why do you think, this is still not working?

What's your master data for dimension Date look like and what's your expected result?

The code adds the first 10 members of your Date dimension to your dropdown, showing the description. In case there is no description maintained the dropdown will show the ID.

shilpa_banerjee
Explorer
0 Kudos

I have a single value of data and 500 records in my model. I want to see this one data..either as a single value or repeated(not sure how SAC will interpret it).

Regards,

Shilpa

Susanne_Helbig
Product and Topic Expert
Product and Topic Expert
0 Kudos

SAC will add a member only once to your dropdown. If you want to see only '2021-09-14' then you need to add an if-condition to your code which identifies this member and adds only this to your dropdown.