cancel
Showing results for 
Search instead for 
Did you mean: 

[SAC] Passing a "TargetDate" argument to a Data Action

peter1998
Explorer
0 Kudos

Hello,

I have a Data Action that includes the following instruction:

MEMBERSET [d/Date] = BASEMEMBER([d/Date].[h/PATTERN_YQPW], %TargetDate%)

Now, I need to pass an argument to this data action, from the script in my analytical application. How should be such argument formatted if I want to limit the scope to the 3rd week of 2022? The Date dimension uses the YQPW hierarchy.

...
DataAction_1.setParameterValue("TargetDate", ...);
DataAction_1.execute();

I tried many different combinations (including [Date].[YQPW].[Date.CALWEEK].[202203]) but nothing seem to work, so here I am.

I used the ID recommended by Nikhil Anand and in my Data Action monitor the exclamation point next to the TargetDate parameter is gone, however the VALIDATION error is still present.

The process doesnt reach Advanced Formulas(AF) and it fails at the validation step. The problem is most likely Date related because when I hardcode it in my AF no errors show up. Does anyone have an answer to this question or a resource that I could make use of to find an answer myself?

Thank you Nikhil for trying to help, I really appreciate it. Im sorry I have to communicate through the post but all of my comments are stuck in the pre-moderation queue

anne-petteroe
Community Manager
Community Manager

Hello Peter,

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers, as it provides tips for preparing questions that draw responses from our members.

Feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html as well, as that will also help you when preparing questions for the community.

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage your readers to respond.

Kind regards,
Anne

N1kh1l
Active Contributor
0 Kudos

peter1998

Did you try this ? Can you show the parameter configuration screen. The cardinality should be single for this parameter.

DataAction_1.setParameterValue("TargetDate", "202203");
peter1998
Explorer
0 Kudos

Hello Nikhil, yes, that's the exact line that im using.

Accepted Solutions (0)

Answers (1)

Answers (1)

N1kh1l
Active Contributor
0 Kudos

peter1998

setParameterValue(id: string, value: string | string[] | DataActionParameterValue JSON | number): void

The parameter is of type string for this API

It should be the just the id ( first column ) of that week member for the year which you can find in the date dimension. as per my week settings (4-4-5) its "202203" ( assuming week is the lowest level)

If Day is the lowest level, it will be still "202203" but now it will be parent of day

Br.

Nikhil

peter1998
Explorer
0 Kudos

nikhil_1486

I really appreciate your help. I used the ID that you recommended and it seems that in my data action monitor the type of Date parameter is no longer the issue. However, the validation error still occurs and when I hardcode the value in my data action the problem is gone. So it's still Date related. When I try to hardcode the value, the advanced formula editor recommends the following value [2022].[20221].[202201].[202203]. Do you have any idea as to what could be causing this issue?

Kind regards,
Peter