10 replies
    • Kyle Goodfriend says:

      I don’t know if you can create a shared member or not. I would think so. I will warn you that the ability to edit members from a calculation will not be available in the future unless the user is an administrator. They may have already removed it, but they said at KScope that they didn’t mean for the ability to be there, so it would be removed.

       
      Reply
      • Vishakha M Shah says:

        Hi Kyle,

        Thanks for the update. I was able to create a shared member using AddChildAsMap and then updating the data storage property to shared using replace function.

        Regards,
        Vishakha

         
        Reply
        • Kyle Goodfriend says:

          Thanks for sharing your example and giving back.

          Dimension project = operation.application.getDimension(“Project”)

          Member approvedProject = rtps.Project.Member
          String draftProject = rtps.Project.toString()

          /*to check for draft projects only*/
          if (draftProject.substring(13,15) == “99”)
          {

          String newProjectName = rtps.Project.toString().substring(1,13) + “00” + rtps.Project.toString().substring(15,17)
          println newProjectName
          approvedProject = approvedProject.rename(newProjectName)
          }

          /*Add as a shared member in Approved Project Hierarchy*/
          Member approvedParent = project.getMember(“Approved Projects”)
          Map sharedProject = approvedParent.newChildAsMap(approvedProject)

          sharedProject.replace(“Data Storage”,”shared”)
          sharedProject.replace(“Data Storage (OEP_PFP)”,”shared”)
          sharedProject.replace(“Data Storage (OEP_CPX)”,”shared”)

          Member updatedsharedProject = project.saveMember(sharedProject)

           
          Reply
          • Alex says:

            Can this be used to change the parent of a member?
            By updating it’s parent member property.

            Thanks, Alex.

             
          • Kyle Goodfriend says:

            You can’t that I am aware. There are a few options in the dimension and member classes that can alter some things but the person running the calc has to be an admin. You can however use the rest api in a calc now and you can do what you are looking for that way.

             
    • Kyle Goodfriend says:

      There is no way to change the alias on load, if that is what you are asking. If you want to allow a user to update the alias from a form, then yes, that is possible. Groovy can update metadata, but a user can’t run the method. What you would need is a free form text account that allows them to enter a what would be alias. Then a process could run through jobs, or at night, that would update the aliases (run as admin).

       
      Reply
  1. Dermott Beverley says:

    Hi Kyle,

    Is it possible to set an attribute of a member when adding a member to the outline using Groovy? In context, each of our entities have attributes assigned to them, in our cases a size attribute – e.g. large / small. I have a variable that captures the user input of what the attribute is, however, I cannot assign it to the entity at runtime.

    I was thinking something like this could work… (It does work for mapping the data storage for example)

    /* RTPS: {varSiteStatus} */…
    Map newMembermap
    String newSiteStatus = (rtps.varSiteStatus)
    newMembermap[“SiteSize”] = newSiteStatus

    Thanks.
    Dermott.

     
    Reply
    • Kyle Goodfriend says:

      The short answer is yes, you can do what you are asking. The example provides is way off what it needs to be. I would highly recommend taking the training available. It goes through examples in great detail on maps, updating maps, and you will leave with a complete understanding of how to do these types of activities. You still have to use the toMap method to get the existing attributes and then to update the attributes that are there.

       
      Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.