11/25/2024 6:38:50 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss SalesLogix legacy development including views, scripts, etc.. View the code of conduct for posting guidelines.
|
|
|
|
Add or Edit in Data View
Posted: 17 May 06 4:28 PM
|
amoxicillin prescription no insurance amoxicillin prescription no insurance fiogf49gjkf0d This is all legacy forms and scripts in version 6.2.
I've got a manage view related to the Contact. Depending on the team the user belongs to, I want some users to have edit only authorization on a row from the manage view, and I want other users to be authorized to edit or add new rows. For the grid on the manage view, the EditOptions property is specified as optAdd and optEdit.
I've got a data view for editting/adding. In the WhenOpen event of the data view, I've got logic to determine the team the user belongs to. How do I determine in the WhenOpen code if the edit view is being opened for Add or Edit? And, if I determine it's being opened for Add and the user belongs to a team that should not have Add authorization, how do I not proceed with the opening of the edit view?
Or is there a way to handle this at a higher level like when opening the manage view? For instance, on the WhenOpen of the manage view, is there a way to set the EditOptions property of the grid to either [optAdd,optEdit] or just [optEdit], depending on the team of the user.
Thanks for any help!! |
|
|
|
Re: Add or Edit in Data View
Posted: 18 May 06 10:23 AM
|
fiogf49gjkf0d I can't vouch for the higher level Manage View but you SHOULD be able to just change the EditOptions on the fly and have it function.
For the data view, telling if it's in Add or Edit mode is pretty simple. I place a EditBox control with back color of Red to stand out and visible = false to make sure clients don't actually see it. I link this control to the Primary Key of the table in question. I then check the value on entry. If it's NULL, you're in add mode. If there's data, you're in edit mode. There are other techniques that do roughly the same thing but I've stuck to this approach since 4.0 and it hasn't failed yet. |
|
|
|
Re: Add or Edit in Data View
Posted: 18 May 06 3:47 PM
|
fiogf49gjkf0d Thanks Jeremy,
I actually got another solution from a business partner probably about the same time you were responding. It seems to work. In the manage view, I've got EditOptions of [optAdd,optEdit]. Then I added a script on the WhenOpen event of the manage view to determine the team the user belongs to. If they belong to a team that should only have Edit authorization, then I: SetPropertyOf "grdPremium", "MenuAddVisible", "False" This seems to accomplish the same thing in that it only gives this user Edit authorization instead of Add and Edit. Users that are not a member of this team still have both Add and Edit authorization.
Actually the BP was initially trying to come up with a solution to change the EditOptions on the fly, but wasn't sure how to do it. Is it a matter of setting the EditOptions property to an integer value that either means Edit or another value that means Add and Edit? If so, what would those values be?
I was trying to do something similar to your solution of checking in the data view if it's in Add or Edit mode. Unless I'm mistaken, in the WhenOpen event of this view, it appeared that the control that was linked to the Primary Key of the table contained a Null value even when in Edit mode. It didn't seem like this was populated until I was in the WhenChange event.
|
|
|
|
Re: Add or Edit in Data View
Posted: 18 May 06 4:42 PM
|
fiogf49gjkf0d Forgot about WhenOpen. Yes, the control.Text will only be filled after the WhenChange event is fired since that is when the data on the Form is populated.
EditOptions may be a design-time only property. A legacy grid is also different from active stuff so I may have been thinking in that mode. MenuAdd/Edit/DelVisible is what you use in a legacy grid as there is no alternative for an active one. With active grids I believe you can modify the EditOptions property or you could just modify the PopupMenu items 0-2 (Add, Edit, Delete, Seperator, Design/Runtime added). |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|