problem in building schemas using code(SchemaBuilder API)

Hello,I try to build a schema and save it to a file using SchemaBuilder API, dynamically, based on list of fields which i pass from the DB(list of columns in a view connected as a Relational Data Source). Every time number and names of the columns in a view can be different and I would like also to avoid using hard-coded names of attributes in web application (because they can change at any time in db), in other words, I can't do this as below (pseudocode):

if name_of_attribute(i)="Attr1" then

AttributeBuilder Attr1 = new AttributeBuilder("Attr1");

Attr1.Caption = "Attr1";

Attr1.SetExpression<string>("=Fields!Attr1.Value");

Attr1.SetCaptionExpression<string>("=Fields!Attr1.Value");

elsif name_of_attribute(i)="Attr2" then

AttributeBuilder Attr2 = new AttributeBuilder("Attr2");

Attr2.Caption = "Attr2";

Attr2.SetExpression<string>("=Fields!Attr2.Value");

Attr2.SetCaptionExpression<string>("=Fields!Attr2.Value");

end if;--------------------------below I present what I try to do without a success:

Dim oSchema As New SchemaBuilder(schemaFileName)Dim attribute As New ArrayList

name_of_attribute(i) - is a list of names of columns which i would like to be on the list of attributesraport_caption(i) - is a list of names to be captions for the above names

Dynamic schema generator is also not a solution for me because I would like to define attribute's properties on my own.

My question is what would be the right way to make it working as I described at the beginning? I would be thankful for any piece of code in VB as a solution for the above (I have to deal with a project written in VB and don't have much experience in writting the code in this language ;)

I would suggest you to use autogenerate schema method to generate schema. Later you can make use of the Schemabuilder API to modify it. Please take a look at this link which shows how to modify schema.

Hello,I finally managed (today) to do what I meant, on my own. Thanks anyway for your reply :)Solution was simple, just making a function returning AttributeBuilder (or MeasureBuilder) object based on given settings as a parameter and just pass it to attributeDimension.AddField (or measureDimension.AddField)