valuelist based on global relation

I can’t get this working properly:

I have a table with CPU records and a table with Customer Location records and I have a valuelist with all the CPU’s.

In the Customer Location record I’ll select a CPU ifrom the CPU valuelist. The valuelist is based upon a globalnr ‘1’ and a calculationfield in the CPU record with this code:

if(cpus_to_lokaties.lokatiesid == null)
{
return 1;
}
else
{
return 2;
}

Purpose of this relation is to only see CPU’s in the valulist that are not used in other Customer Locations.
This solutions works only halfway; only when I load the cpu record AFTER selecting it, the CPU dissapears in the valuelist :( , so I guess it’s some kind of refresh issue?

Hi,

  1. Make the calculation STORED;

  2. Loop through all the records (one time - to trigger the calc to write the value)

Then your valuelist should work fine.

You can also do a SQL statement to set the valuelist values.

Hope this helps,

Bob Cusick