cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

EPM Insert Member - Custom button(10.1 Classic, SP24)

Former Member
0 Likes
394

Hi,

Our user wants a custom button, upon clicking pop-up should allow them to select & insert members as we do by Right click->EPM->Insert Members. I am successful till the pop-up and selecting single member, but when I select multiple members, it is still showing up only 1 member. Adding to this, I have to add filter also to restrict the user to select particular items only(as we do in "Member Insertion Filtering"). Please suggest me how to solve this issue. Thanks in advance.

Note : I have used the code mentioned in this thread but am I missing anything:

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186338
Active Contributor
0 Likes

Please show your code!

And please explain, how do you want to "insert" member...

former_member186338
Active Contributor
0 Likes

P.S. in order to be able to select multiple members read help: 42.4.5.19 OpenFilteredMemberSelector

Former Member
0 Likes

Hi Vadim,

Thanks for the response.

Please have a look at the below pic for reference. When the user clicks on "Select Object", Insert members window should pop-up where the user inserts 1 member, then Months & comments, then submits the data. Next, he'll add another member & so on. Here, one more catch is, the code which I have written for Text-fields(Months & comments) applies specific to 1st line item only (cells G31 & K31). The code is below pic. Please guide me.

Thanks,

Sandeep

'Member-Insertion pop-up :

Private Sub Cmdbutton_cost_Click()

Dim EPM As New EPMAddInAutomation

Dim selection As String

    selection = EPM.OpenMemberSelector(EPM.GetActiveConnection(ActiveSheet), "COSTCATALOG", EPM.GetContextMember(EPM.GetActiveConnection(ActiveSheet), "COSTCATALOG"))

    If InStr(1, selection, ";") > 1 Then

        EPM.SetContextMember EPM.GetActiveConnection(ActiveSheet), "COSTCATALOG", Left(selection, InStr(1, selection, ";") - 1)

    Else

        EPM.SetContextMember EPM.GetActiveConnection(ActiveSheet), "COSTCATALOG", selection

    End If

    EPM.RefreshActiveSheet

End Sub

'Submit data :

Private Sub cmdbutton_submit_Click()

Dim iRow As Long

Dim ws As Worksheet

Set ws = Worksheets("Fax")

iColumn = ws.Cells.Find(what:="*", searchorder:=xlColumns, _

searchdirection:=xlPrevious, LookIn:=xlValues).Column + 20

If Trim(Me.TextBox_Months.Value) = "" Then

Me.TextBox_Months.SetFocus

MsgBox "Please complete the form"

Exit Sub

End If

ws.Cells(iColumn, 7).Value = Me.TextBox_Months.Value

Me.TextBox_Months.Value = ""

Me.TextBox_Months.SetFocus

If Trim(Me.TextBox_comments.Text) = "" Then

Me.TextBox_comments.SetFocus

Exit Sub

End If

ws.Cells(iColumn, 11).Value = Me.TextBox_comments.Text

Me.TextBox_comments.Text = ""

Me.TextBox_comments.SetFocus

Call Save

End Sub

'Close form(dialog-box)

Private Sub Cmdbutton_close_Click()

Unload Me

End Sub

Private Sub UserForm_Click()

End Sub

Sub Save()

Dim EPM As New FPMXLClient.EPMAddInAutomation

EPM.SaveAndRefreshWorksheetData

End Sub

former_member186338
Active Contributor
0 Likes

Sorry, but how do you want to insert member using "EPM.SetContextMember"????

It's used only to change context member! Don't copy paste code without understanding

Former Member
0 Likes

Hi Vadim,

Sorry, I m pretty bad at coding part(macros) . I have even tried using the below code, but I know I am wrong. Could you please correct it as this is very important & urgent to me.

Sub Add()

Dim selection As String

    selection = epm.OpenMemberSelector(epm.GetActiveConnection(ActiveSheet), "COSTCATALOG", epm.AddMemberToRowAxis(epm.GetActiveConnection(ActiveSheet), "COSTCATALOG"))

    If InStr(1, selection, ";") > 1 Then

        epm.AddMemberToRowAxis epm.GetActiveConnection(ActiveSheet), "COSTCATALOG", Left(selection, InStr(1, selection, ";") - 1)

    Else

        epm.AddMemberToRowAxis epm.GetActiveConnection(ActiveSheet), "COSTCATALOG", selection

    End If

    epm.RefreshActiveSheet

End Sub

former_member186338
Active Contributor
0 Likes

AddMemberToRowAxis will add member to row axis, but it's not the same as "EPM Insert member"

former_member186338
Active Contributor
0 Likes

And what do you mean by this code (in bold):

selection = epm.OpenMemberSelector(epm.GetActiveConnection(ActiveSheet), "COSTCATALOG", epm.AddMemberToRowAxis(epm.GetActiveConnection(ActiveSheet), "COSTCATALOG"))

???

Sorry, I will not write the code instead of you, you have to spend some time!