Valid if set blocks the edit action of the row

Hi,

i am creating an application for testing production machines.

Every machine has a list of  'Checks' that need to be done.

I have a machine table and a checks table (each control is related to a single machine).

The 'Tests' table allows to save each test have been made to a new machine and has got the reference to the 'Machine' table and the 'Controls' table.

The intention is to have an insertion form that has this behavior:

  • When the user selects a machine, the app suggest him only the controls relating to the selected machine.
  • When the test is saved, if the user reselects the machine in a new form the app suggest him the controls relating to the selected machine minus the test that has already been done.

To have this behavior I applied this expression to the valid if:

IN([_THIS],
SELECT(OPERAZIONICONTROLLO[IdOperazione],[Macchina]=[_THISROW].[Macchina]) -
SELECT(Collaudi[OperazioneControllo],[Commessa]=[_THISROW].[Commessa]))

The expressions works very well in new rows, but when i want to edit a test row it tells me that the input is invalid because a row with that type of check is already saved in the 'Tests' table.

So my question is:

How can I optimize this expression without invalidating the record edit? 

 

@Steve @Joseph_Seddik @Marc_Dillon @TeeSee1 @Aleksi @Koichi_Tsuji 

Solved Solved
0 9 230
1 ACCEPTED SOLUTION

SELECT(
  OperazioneControllo[IdOperazione],
  ([_THISROW].[Macchina] = [Macchina])
)
- SELECT(
  Collaudi[OperazioneControllo],
  AND(
    ([_THISROW].[Commessa] = [Commessa]),
    ([_THISROW].[_ROWNUMBER] <> [_ROWNUMBER])
  )
)

View solution in original post

9 REPLIES 9
Top Labels in this Space