Protecting Items

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Protecting Items

Post by john »

Hi

Just a quick one I hope. Is it possible to make values read only to a user once the have ALREADY BEEN ENTERED BY SOMEBODY but allow access if they are not already filled in? I used a rule

If Temp.Value IS DEFINED Then PROTECT Temp.Value From PayrollAssistant

in the hope that once the information had been input (into temp.value) they would not be able to go back and ammend it. This however seems to just get stuck in a loop because it will let me put the changes in, then the protect rule applies so it discards them (leaving an empty field) allowng me to put a value in again. Not quite what I was after.

I have managed to get around this briefly by using a rule to populated another value, and a rule that states when this value becomes populated the first one is protected (I hope that makes sense). I would like to do something similar now but with a lot of fields so this solution isn't really going to be an option. Basically I need temp.value (and many others) to become read only to the PayrollAssistant once they are filled in, but allow the payroll to insert a value if they are empty.

Is there any other way to achieve what I am trying to do?

Many Thanks
John
ab042
Posts: 326
Joined: Mon Jul 17, 2006 4:11 am

Post by ab042 »

I also had a need that effected a lot of fields and had requested a presentation attribute on a form layout cell that would have allowed us to select if a field was editable or not and there response and suggestion was in this thread: http://www.awareim.com/forum/viewtopic.php?t=910

AwareIM response at the time was that its clearly business logic since its form dependent. Although I would agree its logic and form based so is every other attribute on the form layout cell page. And for what its worth I believe its crazy to require a developer to create a hundred rules when a simple check box would solve the problem.

In your case a check box during the Business Object definition to make the attribute read only after its defined and saved sounds like it would solve your issue and in my option make programming in AwareIM a lot easier. Most data base developer products allow for a READ ONLY field and I hope Aware considers one in a future update.
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

You need to re-write your rule like this:

If OLD_VALUE (Temp.Value) IS DEFINED Then PROTECT Temp.Value From PayrollAssistant

You can also protect the whole object at once based on the value of a given attribute, if it suits you:

If OLD_VALUE (Temp.Value) IS DEFINED Then PROTECT Temp From PayrollAssistant

Either way, there is no need for unnecessary rules or additional attributes.

Read-only attributes are called Calculated, and have always been available in Aware IM. As the name suggests they do not allow user input whether on entry or editing of objects.
Aware IM Support Team
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

Thanks Aware Support and also AB042 for that. I didn't realise there was a function called OLD_VALUE. I will give this a try. I must say though that sometimes it would be nice to see some of these prefixes in the suggested text. Things like this and the old favourite "LoggedIn" are not available. As I am a very basic level programmer I tend to rely on it

Anyway thanks very much for your help again
John
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hmm Curious

I am getting a syntax error at IS DEFINED:

If OLD_VALUE(Temp.AccountName) IS DEFINED Then PROTECT Temp.AccountName FROM ALL EXCEPT Administrator

I have replaced with:

If OLD_VALUE(Temp.AccountName) <>'' Then PROTECT Temp.AccountName FROM ALL EXCEPT Administrator

Seems to be accepted but doesn't seem to do anything?

Thanks
John
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

I just wanted to give you an update, the rule I put in the system works a treat however as I suggested I have a lot of values I need to do this for. I wrote a long list in the form:

If OLD_VALUE(Temp.AccountNumber) <>'' Then PROTECT Temp.AccountNumber FROM ALL EXCEPT Administrator
Else If OLD_VALUE(Temp.Address2) <>'' Then PROTECT Temp.Address2 FROM ALL EXCEPT Administrator
Else If OLD_VALUE(Temp.Address3) <>'' Then PROTECT Temp.Address3 FROM ALL EXCEPT Administrator

However the problem here is when the first is true, only the first value is protected. Is there an easy way to create a list to achieve this or am I right in thinking I have to write a seperate rule for each value. I have about 21 values so this, added to the rules I have already got=a lot of rules. As a side question therefore do you have any figures at all on how many rules I am allowed to have for creation of a business object?

Thanks
John
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

If you want to control each value individually, you have to have a separate rule for it. If, on the other hand, you want to protect the whole object based on the value of one attribute, you can do it as descried in the earlier post. It is also possible to protect several attributes based on the value of a single attribute, i.e. have a rule with a single condition and multiple protect actions.

There is no limit on the number of rules you can attach to an object. You can use copy/paste to speed up addition of similar rules.
Aware IM Support Team
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

Thanks again for that, I was wondering really how the performance would be affected with me adding lots of rules. I have created the rules, yes copy and pasting is a god send. All is working fine and I have 64 rules attatched to the creation of this one object now and you really cannot tell! I expect another 10 - 15 (other stuff) should finish it off.

Great System, Thank you!!!

Thanks
John
Post Reply