Related field in the grid control

Posted by Rollbase User on 20-Sep-2012 12:18

Hi Hi, Example: In the Grid control I have one grid field, called accountnumber, which is related to an object accountnumbers. This object has three columns: Accountnumber, description and value1. I have also other grid fields which i have called description and value1. How can i automatically put the description and value1 based on the first field accountnumber (related field). Summarized: Grid fields: Accountnumber, description, Value1 When clicking on accountnumber (lets say 100) field in the grid-control, the following columns are available: 100, First description, 123 200, Second description, 456 I cannot automatically fill the description and the value1 columns in the grid-control. I have tried the page script and the related field field type. But it does not work properly. Any idea's?

All Replies

Posted by Admin on 20-Sep-2012 12:23

By the way, i have put the grid control in a page of another object. There is a relationship between this object and the object where the accountnumber is part of..

Posted by Admin on 20-Sep-2012 12:25

Relates fields are, by definition, read-only. You can use Related fields in Grid control, but you cannot change them.

Posted by Admin on 20-Sep-2012 15:12

Hi Pavel,

Thanks for the quick reply. The related fields does not work correctly in the grid control when having two (or more) rows with the same accountnumber. You can reproduce it as follows:



- You need an object called accountnumbers, which has the accountnumbers, descriptions and value1's

- Create an object test1

- Create an object test2

- Create a relationship between these objects (one to many test1 - test2)

- Create a relationship on test2 to accountnumbers (one to one)

- The test2 object has now a lookup field to accountnumbers, create a related field called Value1 (refer to accountnumbers - value1)

- Create a grid control on test1 (new test1) and put the fields accountnumber and value1 into the grid



Now it works when selecting unique accountnumbers, the value1 field will get the related value. When having 4 grid rows, try to select all the same accountnumbers (like 123), save it and open it again. Only the last row has the value 123. The first three rows are empty....







Posted by Admin on 20-Sep-2012 15:56

OK, I'll take a look, this may take a few days.

Posted by Admin on 24-Sep-2012 11:31

Hi Bakar,



This is because of ::

- Create a relationship on test2 to accountnumbers (one to one)



Change your relationship hierarchy to Many test2 to one accountnumbers.



By definition 1-is-to-1 relationships will only have 1 record related to 1 record at any given time. Your example shows 4 test2 records trying to relate to a single accountnumber record. Since the hierarchy is 1:1, it will automatically detach the first three records on the grid (save stack / after-update [top to bottom] from the grid).



Hope this clarifies.

Piscoso, Martin

Rollbase

Posted by Admin on 24-Sep-2012 13:27

Hi Martin, pavel,

Indeed, the relationship causes the weird behaviour? You're right. Thanks a lot for the support.

This thread is closed