Get data mapping and Set data mapping

Posted: 2017-01-17 in Data mapping

Q:
I think is related with data mapping, but I’m not sure. Using the southwind database and trying to do a simple invoicing program,
I create a new page (page2), add a form section (section1) and drop there the orders table fields.
I then add a second section, but this time is a grid(section2) and I add the order details fields (order id, product, price, qty).
Then, I try that the price field automatically updates its content with the “unit price” that figures for that product in the products table, whenever you change the product.
If you select product 1, in the price field of the grid should automatically appear the “unit price” of the product 1 that is in the products table.
I thought that I could get that with data mapping but I’m a little bit lost, as I also want the user to be able to overwrite that value. I’ve tried to specify in the “get data mapping” field of the price column: keylookup(“products”,”productid”,{},unitprice), and leaving set data mapping blank, but it doesn’t work.
A:
The keylookup() needs to reference the order_details.productid, not the current unitprice cell value, which is what the {} means in

Code:
keylookup("products","productid",{},unitprice)

So it becomes:

Code:
keylookup("products","productid",order_details.productid,unitprice)

The ‘Recalculate’ attribute on the productid column should be checked to True to trigger the recalculation of calculated and readonly columns in the Grid.



Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s