Community
Showing results for 
Search instead for 
Do you mean 
Reply

Add rows to CustomEntity

Accepted Solution Solved
Highlighted
Copper Contributor
Posts: 7
Country: Germany
Accepted Solution

Add rows to CustomEntity

I created a CustomEntity and added some columns with:
Act.Framework.Database.FieldDescriptor field = new Act.Framework.Database.FieldDescriptor( "type", descriptor, Act.Framework.Database.FieldDataType.Character);

Now I  tried to add a row to my CustomTable with:
CustomLinkRow row = ActApp.ActFramework.CustomEntities.GetSubEntityManager<CustomLinkRow>"CustomLink").CreateCustomEntity();
//whereas:
//public class CustomLinkRow : CustomSubEntity
//public class CustomTable<T> where T : CustomSubEntity
CustomSubEntity.CustomSubEntityFieldCollection cfc = row.CustomSubEntityFields;
//cfc["type"] = "T1";
cfc["type", Act.Framework.MutableEntities.FieldNameType.Alias] = "T1";
 
But i get the following exception:
Act.Framework.MutableEntities.MutableEntityMetaDataArgumentException:
{"LookupColumnByAlias: alias not valid field name\r\nParametername: alias"}


Why isn't it working?


Thanks a lot, Primius.

Accepted Solutions
Solution
Accepted by topic author primius
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 7
Country: Germany

Re: Add rows to CustomEntity

OK, i solved the problem.

I changed the code to add the table columns as follows:

Act.Framework.Database.FieldDescriptor field = new Act.Framework.Database.FieldDescriptor( 

"type", "type", descriptor, Act.Framework.Database.FieldDataType.Character);

 

whereas the 2nd "type" defines the alias, now i can use:

cfc["type", Act.Framework.MutableEntities.FieldNameType.Alias] = "T2"

 

Thanks, Primius 

 

View solution in original post


All Replies
Employee
Posts: 1,163
Country: USA

Re: Add rows to CustomEntity

If I'm not mistaken, here: cfc["type", Act.Framework.MutableEntities.FieldNameType.Alias]

 

You can drop the second parameter. Also try changing the FieldNameType to Real. 

Matthew Wood
Act! SDK Support
Community Moderator
Copper Contributor
Posts: 7
Country: Germany

Re: Add rows to CustomEntity

I already tried:

cfc["type"] = "T1";

as you can see at the commented line above (in my first post)

 

cfc["type", Act.Framework.MutableEntities.FieldNameType.Display] = "T1";

cfc["type", Act.Framework.MutableEntities.FieldNameType.Real] = "T1";

cfc["type", Act.Framework.MutableEntities.FieldNameType.Alias] = "T1";

 

Nothing of that works. Is there another thing i can do?

Thanks, Primius

Solution
Accepted by topic author primius
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 7
Country: Germany

Re: Add rows to CustomEntity

OK, i solved the problem.

I changed the code to add the table columns as follows:

Act.Framework.Database.FieldDescriptor field = new Act.Framework.Database.FieldDescriptor( 

"type", "type", descriptor, Act.Framework.Database.FieldDataType.Character);

 

whereas the 2nd "type" defines the alias, now i can use:

cfc["type", Act.Framework.MutableEntities.FieldNameType.Alias] = "T2"

 

Thanks, Primius 

 

New Member
Posts: 9
Country: USA

Re: Add rows to CustomEntity

[ Edited ]

>Hello primus, I see you solved the issue but i dont really understand how. Did you manage to add rows?or columns? You replace:

 

CustomLinkRow row = ActApp.ActFramework.CustomEntities.GetSubEntityManager<CustomLinkRow>"CustomLink").CreateCustomEntity();
CustomSubEntity.CustomSubEntityFieldCollection cfc = row.CustomSubEntityFields;
cfc["type", Act.Framework.MutableEntities.FieldNameType.Alias] = "T1";
 

 

>with this:

 

Act.Framework.Database.FieldDescriptor field = new Act.Framework.Database.FieldDescriptor( 

"type", "type", descriptor, Act.Framework.Database.FieldDataType.Character);

cfc["type", Act.Framework.MutableEntities.FieldNameType.Alias] = "T2";

 

If i understand correct you added a new row and u didn't use the CreateCustomEntity();

or

You just replaced the last 2 lines of the code on top ?

 

Could you explain why u use "type" 2 times?