The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Active user
Rating: 5
Joined: Jun 4, 2013
Company:

Hi
I'm trying to write a catalog record but by variables  ... for example
if i want to fill an attribute called price in a catalog ... i want to refer for it by variable


(this is a wrong example but i will write it to make you understand more)

Code
o=Catalogs.Catalog1.CreateItem();
variable="price";
o.variable=123;
o.write();


It doesn't work for sure ... but can you give me a way to solve this problem ?

and thank you in advance

 
#2
People who like this: 0 Yes / 0 No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

try so

Code
o=Catalogs.Catalog1.CreateItem(); 
variable="Price"; 
o[variable]=123; 
o.write();

 
#3
People who like this: 0 Yes / 0 No
Active user
Rating: 5
Joined: Jun 4, 2013
Company:

I can't believe it  ... it worked ... thanks a lot!!

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)