I am trying to set a limited access in security as shown below, which works fine.
But I want to also have the same limit when evaluated from another context (like below) Is there a way to set both for the same table?
So, you're doing a self-join between vehicles? And what is the restriction you want in this case? Is it that if the related Trade_vehicle is locked, the "parent" vehicle should not be visible to the user or is it that if the "parent" vehicle is locked then the Trade_Vehicle should not be visible to the user?
VEHICLES::z_RecordLock ≠ "Locked" should work for all contexts. The "Evaluate this calculation from the context of:" should only come into play when you are referencing related records, which you are not in this case.
But it the related records that I also want to set limits to
I'm not entirely sure what you mean. If a user has the privilege set that limits viewing of records in the VEHICLES table to cases where VEHICLES::z_RecordLock ≠ "Locked" then you're good to go. Your restriction on the VEHICLES table applies to all Table Occurrences based on the VEHICLES table.
If you would like to restrict access to records in other tables (not other Table Occurrences of VEHICLES) based on the z_RecordLock value in the related VEHICLES table, you will need to specify corresponding limits in those tables. How you do that depends on your relational schema. What tables are related to the VEHICLES table?
The 2nd image is the table occurrence where a vehicle is related to another vehicle through the relationship vehicle_Trade_Vehicle
Yes I want the vehicle locked and the related trade vehicle when it is from the context shown to be locked
If that's the case you I can't give you an exact answer without seeing the relationship graph. It may not actually be possible to do what you what. Assuming that you have just two table occurrences (VEHICLES and vehicle_Trade_Vehicle) in play, try the following:
From the vehicle_Trade_Vehicle context:
VEHICLES::z_RecordLock ≠ "Locked"
and vehicles_Trade_Vehicle::z_RecordLock ≠ "Locked"
I'm not sure this will work, but give it a try.
As the outcome is yes/no that will not resolve the issue.
The outcome needs to be Boolean, so either 0 or 1. The calculation I posted will return either 0 or 1 so is valid. Whether or not it is the correct calculation to achieve your aim is a different matter
Retrieving data ...