UD Table as Child, how to partially restrict Entry or Changes?

I have added a UD table as a child (using the Wizard and Keyed to the Company, QuoteNum, QuoteLine) because we have many to one relationship. Multiple users will be entering data into this UD table, from an epiUltraGrid either in Quote Entry or Order Entry. Paste/Insert functionality is important to us. I have all of that working the way I want.

Now I want to restrict entry into certain columns of the UD table to certain groups. I have created an in-trans data directive that checks the condition if the user is a member of a particular group and if not, then the next condition checks if a particular field has been changed from any to another, then raise an exception. This will prevent any other user (not from the designated group) from changing data on an existing line and this restriction is working (it stops at attempt to save).

Issue 1: This BPM does not stop any user from populating that UD Column on the epiUltraGrid line with an initial value.
Is there a way to prevent a user (not in the designated group) from entering an initial value in that one column of the UD table (without breaking the paste insert functionality)?
Issue 2: If a Paste/Update is done and the field is changed, the whole update has to be undone.
Is there a way allow a multi-line paste insert/update, but not accept any changes or initial values for that one column of the UD table (unless the user is in the designated group)?

For #2, you could test for the user first, and if they’re in a group not allowed to update a particular column, you could replace the column of the ttData, with data currently in the UD table, and allow the write of the ttData to continue.

@ckrusen that sounds like a good idea. Is there a standard widget that would do that, or will I have to use the Custom Code widget? I am not very good with C#.

You can use the Set Field widget, and a relatively simple expression to fetch the existing value.

So if you wanted a paste update to not replace Number01, you’d select the Number01 field in the widget, and set the expression to something like:

Db.UD10.Where( r =>r.Company == ttUD10Row.Company 
&& r.Key1 == ttUD10Row.Key1 
&& r.Key2 == ttUD10Row.Key2).Select( r =>r.Number01 ).FirstOrDefault()

(Edit: Original code referred to tt table as ttUD10. Should have been ttUD10Row. And should not have ended with a semicolon)

That’s totally off the top of my head(and untested), and will probably need tweaking. Might need to add more keys.

What that does (or is supposed to do), is return the value for UD10.Number01, for the UD10 record who’s Company, Key1 and Key2 values equal the respective fields in the ttUD10 table.

Effectively replacing the value being pasted to Number01 with the value already in Number01.

And for #1 you could use the Set Field widget to make the field that shouldn’t be written to, to be blank - or null, or 0.0… whatever the default is for that type of field.

@BKen - I did some testing and using DD’s to prevent a particular field from being updated has a few drawbacks. Namely the UD table isn’t updated until the Quote is saved. Therefore anything pasted into the grid appear there. And it would probably take a save and a refresh to show the unchanged data.

Instead you should use Field Security. That automatically makes the column read only for the specified users.

Here’s what I set in Field Security for Ice.UD10.Character02:

image

I set the access for my test user account, to Read, and now that grid in the Quote entry looks like:

image

It might not be obvious, but column Character02 is greyed out. And pasting clipboard contents of:

image

yields

image

Note that all the other fields updated except Character02
Updates all

Edit

And i’t probably best to create and use security groups for the Field Security, over individual users.

1 Like

@ckrusen your suggestion works excellent. I did not think that could be done with a UD table, but it works perfectly (and does not break paste insert or paste update).

Thank you so much for looking into this and testing the solution. With security manager rights, you do not see any of the greyed out columns, so a test account is important to verify functionality (I see Calvin is using a test account too).

Because I am linking this UD table to a couple of different forms, Field security is carried through to each form.

Thanks again, this works better than I was expecting.