Copying Attributes from one object to another with reference

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
denisv
Posts: 253
Joined: Thu Jan 19, 2006 4:36 pm
Location: Ireland
Contact:

Copying Attributes from one object to another with reference

Post by denisv »

I have three busines objects:

a) Product Header
b) Product Items
c) Product Template

A Product is made up of Business Object Product Header with Reference to Product Items.

Product Template has 3 attributes that are the same as 3 of those in product items and one attribute that would contain a value matched to one attribute in product header.

What I want to do is allow a user create a new product by entering the details for product header, and creating. Based on one value in product header (e.g. Group), I want a process that will copy all product template items with the same Group Value against them into Product Items business object referenced to the product header where inline editing would then let the user finish entering some additional data per line item.I have looked at Create but doesn't seem to allow use of the reference and also enter new but that awaits user input per instance.

Is there a way to do this ?
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

I understand your intention is (correct me if I am wrong) to pre-populate a product with items according to some product template.

First, you need to add object ProductItemTemplate and attribute Items to object ProductTemplate of type ProductItemTemplate. These will be used to manage product and item templates.

When you need the user to start entering a new product from product header, you can do it by a process like this:

FIND ProductTemplate WHERE ProductTemplate.Group = ProductHeader.Group
ENTER NEW Product WITH Product.Template = ProductTemplate

You also need to add a rule to object Product that will pre-populate its items based on template items, for example:

If Product.Items IS UNDEFINED AND Product.Template IS DEFINED Then
FIND ProductItemTemplate WHERE ProductItemTemplate IN Product.Template.Items
CREATE ProductItem FOR EACH ProductItemTemplate WITH ProductItem.Product = Product, ProductItem.SomeAttribute = ProductItemTemplate.SomeAttribute, ...
Aware IM Support Team
denisv
Posts: 253
Joined: Thu Jan 19, 2006 4:36 pm
Location: Ireland
Contact:

Post by denisv »

Can I clarify this, is this possible:

a) Object Product has ref atts; Product Header, Product Items

b) Object Product Template has ref atts; Product Header Template, Product Items Template

When a user wants to create a new product they need to create a new product object and save it. At that point they need to be able to execute a process that copies the entries from Product Header Template into Product Header and Product Item Templates into Product Items based on a matched value in Product - Product Template. There should be no obvious refernced link between Products and Product Templates.

I am assuming they have to at least create the Product Object without it's referenced attributes to give the matched value for the field that is common between Product and Product Template and make available the Process Button ? Or can a process be started by prompting for the value?
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

The user needs to select which product template to use. One way of doing this is to add a reference attribute of type ProductTemplate to ProductHeader and let the user start by entering the ProductTemplate object. Once the user selects the desired template type, and enters other necessary information into ProductHeader, the user can proceed to create the Product. This can be achieved with a process like this:

ENTER NEW ProductHeader
ENTER NEW Product WITH Product.ProductHeader = ProductHeader, Product.Template = ProductHeader.ProductTemplate

The Product will be pre-populated with items based on the ProductTemplate as described in the previous post.

Another way of doing this is to let the user select from the list of available product templates and proceed with creating the Product, which can be done with a process like this:

PICK FROM ProductTemplate
ENTER NEW Product WITH Product.Template = ProductTemplate

You can hide ProductTemplate attribute from the user by simply not placing it on the Product form.
Aware IM Support Team
denisv
Posts: 253
Joined: Thu Jan 19, 2006 4:36 pm
Location: Ireland
Contact:

Post by denisv »

I have tried to use Pick From 'object' but it says that

rule '' uses query 'objectname' which has not been found

It seems to want an additional parameter.
denisv
Posts: 253
Joined: Thu Jan 19, 2006 4:36 pm
Location: Ireland
Contact:

Post by denisv »

I have found a different way to do what I was trying, thank you.
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

ProductTemplate in the "PICK FROM ProductTemplate" example referred to a query name, not an object name. The query can be defined using the standard query functionality to add applicable conditions, sort order, attributes to display, etc.
Aware IM Support Team
Post Reply