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
196

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
William_Yu
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Mike-W

   I'm not sure about your use case. Whatever value user entered in the table is already stored in planning model. What do you want to achieve with data action? 

Best regards, William 

Mike-W
Discoverer
0 Kudos
Hi William, yes correct our model is a combination of "cost centers" and "accounts" for our cost center planning. This combination got no data on opening the story because there is no data stored. Now i added a button to open a form that populates the cost center and possible accounts so they dont need to add a new "row" in the story itself and dont get any help of selecting the correct entry (like typos). In addition to that they add values for each month and those values i want to store in my model (in LC). Ill add some screenshots in a seperate post.