cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Empty MegaCollection Object and add an item to it

ColruytTeam
Honored Contributor

Hi All,

Can any body tell me how to create an empty MegaCOllection Object and how to insert an item in to it.

Colruyt Team
14 Replies

Hello,

 

sorry, but I don't think you can hide values dynamically (at leas, I do not know how to do this).

The only way is to build your value list (as I showed you), but you'll have a refresh problem that I do not know how to manage.

 

Regards

 

Lionel

 

ColruytTeam
Honored Contributor

Hi Lionel,

Can you help me by suggesting the way to hide a metaattributevalue from a dropdown based on some condition in VBScript.

I mean, I have 5 values in dropdown, I want to hide 2 of them (I have their IDs) .

 

So that I can acheive my functionality.

 

Thanks in advance.

Colruyt Team

Hello, 

 

I do not know if what you want to do is possible : it seems to me (but you'll have to verify it) that you will have a refresh problem (and I do not know if the "ResetOnRefresh" Jérôme told you about will solve it.

 

So I guess you could "easily" do what you want to do, but changing the attribute value of your category dropdown list from "Flower" to "Fruit" will not automatically change the item drop down list... You'll first have to close the property page and reopen it to see the updated dropdown list Man Sad

 

Regards,

 

 

Hello

 

I am not a expert but maybe the ResetOnRefresh could help: it is regarding refresh and drop-down lists

 

See

http://community.mega.com/mega/attachments/mega/HOPEXV1R2/10/53/HOPEX%20Forms.pdf
HOPEX Forms - Forms
ResetOnRefresh: 0x0200 (512): This flag is for drop-down lists and elements displaying a menu, and indicates that the menu or content of the list can change if the element has undergone modifications, and therefore needs to be recalculated.

Jerome

ColruytTeam
Honored Contributor

Hi Linoel,

I have two dropdowns, Lets say one is category dropdown and another is items drop down. The first having values like fruits and flowers. On changing of the first drop down, I am firing an event and getting items collection from database . Now I want to fill the second drop down with items dynamically (there I stuck) .

 

As I know we can not have any mapping between categories and items, But I can manage by hardcoding the values in macro.

 

All I need is , How I can push a new collection of values to the second drop down.

 

Thanks in advance.

Colruyt Team

I'm sorry, I do not understand what you want to do.

Can you be more precise please (and give example) ?

ColruytTeam
Honored Contributor

Hi Linoel,

This is working on loading of properties window.

 

But I need to push new values on some event like:

 

1. I am calling a method in a updatetoolmacro1 on change on one dropdown (Achieved)

2. I am getting selected value, based on that option, I am picking collection of values, passing to another updatetoolmacro2.AttCtl_fillCombo function (Achieved)

3. Then I need to push the received set of values to the another dropdown (there I am stuck )

 

Can you suggest me a solution for this.

 

Thanks.

Colruyt Team

Try something like this :

 

'MegaContext(Fields,Types)
'Uses(Components)
Option Explicit

Function AttCtl_GetDefaultKind() As String
  AttCtl_GetDefaultKind="DropDownList"
End Function


'Must be implemented to fill a drop-down list - return the values type
Function AttCtl_FillCombo(oContext As MegaUpdateToolContext,oFillCollection As MegaCollection) As Integer
  Dim myCol, myObj, oAdded
  Set myCol = oContext.getRoot.getSelection("")

'Fill your collection myCol here... For each myObj in myCol Set oAdded = oFillCollection.Create(myObj.getId) oAdded.GUIName = myObj.shortname oAdded.InternalName = myObj.getprop("_HexaIdAbs") Next
AttCtl_FillCombo = myCol.count + 1
End Function

Lionel

ColruytTeam
Honored Contributor

Thanks Lionel 🙂

It is working.

 

Now I have a collection of my own values.

In the moment, can you tell me how to push collection of values to a dropdown from a macro.

Right now,  am calling updateToolMacro2.AttCtl_Fillcombo method from updateToolMacro1 by passing these new collection of values as parameters.

But the values are not changing in dropdown.

 

THanks in advance.

Colruyt Team

That's why you need to initialize your collection (as I showed you in my last post 😉

 

Lionel