Hi Anil, Thanks alot again
Regards, giridhar raj. --- In Axapta-Knowledge-Village@yahoogroups.com, "axaptadeveloper" <anilo...@...> wrote: > > Hi Giridhar, > > You can use anytype for reflection. This is the best approach. I'm happy for > save your time. > > DictTable DictTable; > Common CommonTable; > > TableName tablename = "AddressCountryRegion"; > > FieldName fieldname = "CountryRegionId"; > fieldName fieldName2 = "Type"; > > Anytype countryname = "A Country"; > AnyType countryType = CountryRegionType::EU; > ; > > DictTable = new DictTable(tablename2id(tablename)); > CommonTable = dictTable.makeRecord(); > CommonTable.(fieldname2id(DictTable.id(),fieldname)) = countryname; > CommonTable.(fieldname2id(DictTable.id(),fieldname2)) = countryType; > > CommonTable.insert(); > > Best Regards, > > Anil OZAY > > > > --- In Axapta-Knowledge-Village@yahoogroups.com, "giridharraj" <giridharraj@> > wrote: > > > > Hi Anil, > > > > Thanks alot.It has worked and you have saved my time by replying promptly. > > I have one more doubt, as I am inserting the data dynamically, how can i > > change the value's datatype dynamically. i.e., > > If we take the below example and the if the field type is a date,int or > > real datatype then is there any possibility to convert the datatype of the > > value which is a string type dynamically according to the datatype of the > > field. > > > > Regards, > > Giridhar raj. > > > > --- In Axapta-Knowledge-Village@yahoogroups.com, "axaptadeveloper" > > <anilozay@> wrote: > > > > > > Hi, > > > > > > This is the sample code : > > > > > > DictTable DictTable; > > > Common CommonTable; > > > TableName tablename = "AddressCountryRegion"; > > > FieldName fieldname = "CountryRegionId"; > > > str value = "Turkey"; > > > ; > > > DictTable = new DictTable(tablename2id(tablename)); > > > CommonTable = dictTable.makeRecord(); > > > CommonTable.(fieldname2id(DictTable.id(),fieldName)) = value; > > > CommonTable.insert(); > > > > > > Regards, > > > > > > Anil OZAY > > > > > > --- In Axapta-Knowledge-Village@yahoogroups.com, "giridharraj" > > > <giridharraj@> wrote: > > > > > > > > Hi, > > > > > > > > I want to dynamically insert the data into a table through code by > > > > getting the table name, fieldnames and its values to be inserted. > > > > > > > > For ex : > > > > > > > > tablename.field = value; > > > > tablename.insert(); > > > > > > > > Here the tablename,field and value are variables.all the variables > > > > takes the values dynamically. > > > > > > > > Is the above thing possible in X++. > > > > > > > > Thanks and Regards, > > > > Giridhar Raj. > > > > > > > > > >