Kategorien
Allgemeines Jedox

Jedox – User CRUD – Manage Dimensions within worksheet

Usecase

Sometimes it´s needed that a user can add elements to a dimension without accessing the modeller – e.g. you wanna budget personal ressources and want to allow power users to add new placeholders to the employee dimension.

Entry mask for new employees

To get this working, you can use multiple ways on how to pass values from the worksheet, to the script – I prefered to use “names” for the parameters I wanna pass to my php:

Name Manager

Then with the “add” button, I use the following macro to insert the new element to the selected parent (trop down) and add the attributes.

/**
* Author <philipp@frenzel.net>
* Create a new ressource with name - Full_Name, Start_Date
*/

function _btnAdd_Click ()
{
  //First Read the values given by formula
  $connection = activeworkbook()->names->item("RNG_CONNECTION")->value;
  $inpFull_Name = activeworkbook()->names->item("crud_name")->value;
  $inpStart_Date = activeworkbook()->names->item("crud_start_date")->value;
  
  //Second retrieve variables
  $inpParentRessource = retrieve_variable("RESOURCES");
  
  //Third add a new Element to the dimension
  $key = $inpFull_Name . "(" . $inpParentRessource . ")";
  application()->palo_eadd($connection,"Resources","N",$key,$inpParentRessource,1,null);
  
  //Forth add the attrbutes to the new element
  application()->palo_setdata($inpFull_Name,false,$connection,"#_Resources","Full_Name",$key);
  application()->palo_setdata($inpStart_Date,false,$connection,"#_Resources","Start_Date",$key);
  
  return __recalc();
}

After you added the new element, with the recalc call at the end of the script, the dyna range should refresh immediatly and you should see the new element.

Schreibe einen Kommentar