cancel
Showing results for 
Search instead for 
Did you mean: 

Writing month values (got from a Form in a story) via a data action to my model (SAC)

Mike-W
Discoverer
0 Kudos
197

Hi everyone, 

im just starting in the World of SAC and im trying to solve a thing i cant wrap my head around. Im sure i missed something or it isnt possible at all. Hope your're getting my problem and help me solve it 🙂

I have the requirement that plan values can be entered on a monthly basis in a form in a SAC story.

These should then be transferred to my model via a data action. Now I can easily write a value to the data. If I then call the dataaction repeatedly (12 or 6 times, depending on the scenario), it takes forever. Now I thought I could manage to enter the values as parameters in the data action

%ParameterPlanningValueJanuary%
%ParameterPlanningValueFebrurary%
...

a parameter like %ParameterStartDate% (Date, Single, Year, Month, Leaf) and %ParameterEndDate% to get the count of all the month to change and then write accordingly to the values to the month. 

MikeW_0-1718696538073.png

 

 

My working DA: 

MEMBERSET [d/D_Accounts] = %ParameterAccount% //Sample -> ("571210") im Code "[D_Accounts].[parentId].&[500095]"

MEMBERSET [d/D_Cost_centers] = %tisParameterCostCenter% // Sample DE100

MEMBERSET [d/Date]= %tisParameterPlanningDate% 

DATA([d/Measures] = "LC",
[d/D_Accounts] = %tisParameterAccount%,
[d/D_Cost_centers] = %tisParameterCostCenter%) 
= %tisParameterPlanningValue%
 
My newest try
INTEGER @COUNT
INTEGER @I
@COUNT=DATEDIFF(%tisParameterStartDate%, %tisParameterEndDate%, "MONTH")

FOR @I= 0 TO @COUNT
//here i want to use a if like If I = 1 then write to January, if 2 then to February. Maybe to do it i also need to change I to a parameter aswell.
The values will be provided by the %ParameterPlanningValue[Month]% paramenters.


DATA([d/Measures] = "LC", 
[d/D_Accounts] = %tisParameterAccount%,
     [d/D_Cost_centers] = %tisParameterCostCenter%,
[d/Date]=NEXT(@I,"MONTH",%tisParameterStartDate%))= @ValueToInsert
ENDFOR

My Code in the scripting part

DataActionCostCenterPlanning_EntryForm.setParameterValue("ParameterCostCenter",DropDownCostCenterSelection.getSelectedKey());
DataActionCostCenterPlanning_EntryForm.setParameterValue("ParameterAccount", "[D_Accounts].[parentId].&["+DropDownAccountSelection.getSelectedKey()+"]");
DataActionCostCenterPlanning_EntryForm.setParameterValue("ParameterStartDate", "[Date].[YM].&[202401]");
DataActionCostCenterPlanning_EntryForm.setParameterValue("ParameterStartDate", "[Date].[YM].&[202406]");
DataActionCostCenterPlanning_EntryForm.setParameterValue("ParameterPlanningValueJanuary", ConvertUtils.stringToNumber(TextBoxValueJanuary.getValue()));
DataActionCostCenterPlanning_EntryForm.execute();

 

 

I hope I was able to explain my case clearly, if not please ask. 🙂

Thanks! 
Mike

 

 

View Entire Topic
Mike-W
Discoverer
0 Kudos

Hi @William_Yu here are some additional Screens to understand my problem better. 

My Model: 

MikeW_0-1718784179325.png 

My Story

MikeW_1-1718784260572.png

My Form: 

MikeW_2-1718784294965.png

 

 

William_Yu
Product and Topic Expert
Product and Topic Expert
0 Kudos
Thanks. I guess your user enter value into the form, then you call data action to bring data to model which is used in the story. How is user supposed to enter value for each period? Why it's not in regular table format but individual input field instead?
Mike-W
Discoverer
0 Kudos

Correct, they should enter each value for the period / month to use it further. 

Why it's not in regular table format but individual input field instead? Thats a good question probably because i didnt know better. Is there a way to use a table in that case? Can you point me in the direction that i try it out. Thank you. 

William_Yu
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can just create a table widget with hierarchy year/month, in which you can enter data on both year and month level. Just like your screenshot of your story.