cancel
Showing results for 
Search instead for 
Did you mean: 

Agentry app - Why button becomes unavailable to press.

Former Member
0 Kudos

Hi All

I have Agentry application, ScreenSet, Screen and Button (With Label - "Add Quantity").

When Button is bind one Action it works as exptected.

It is pressed and execute the Action.

But when Button is bind the other Action, it automatically becomes unavailable for pressing.

How Action affects the state of the button.

My Action have Eanble Rule = Always Enable

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If the rule is enable and the button is grayed out, sounds like a target issue. For Edit Transactions you need to target the current transaction.  If you are adding a Subaction, the transaction needs to be set to a "Add" and the action needs to target the parent object.

Former Member
0 Kudos

Hello Stephen.

Thank you for answer.

I have Edit Transaction - MeanObjChangeCountNum that change one field in the MeanObj.


For Edit Transactions you need to target the current transaction.

I don't see Target property in the "Edit Transaction" General Settings.

Not sure that I understand what is "current transaction".

I have action with Transaction Step


If you are adding a Subaction, the transaction needs to be set to a "Add" and the action needs to target the parent object.

I need to have Edit Transaction (not Add Transaction ) because I change value in the Object.

jason_latko
Advisor
Advisor
0 Kudos

Konstantin,

Don't use "Main Screen Set" in your transaction step target.  I don't think that works reliably.  Target the screen directly under "Other Screensets".

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Konstantin,

I see your action is pointing to "Current Screen:>Current Object"  Is this the object you are tried to change?
Also, is it a MeanObj?

If both are yes, then on your transaction step, you shouldn't need to set a target object.  This is because it will default to the object of the action, which is current set to the "MeanObj" current object.

The point of the Target Object is if you have an action updating one transaction, then you within the same action, you need to target and update a different object.

Former Member
0 Kudos

When I cleared Target Object button became available.

Thank you Stephen.

For me, it is not so easy to understand.

What properties should be left blank which is necessary to fill.

Answers (1)

Answers (1)

jason_latko
Advisor
Advisor
0 Kudos

Konstantin,

Buttons can become disabled when the target object tied to the button does not exist at runtime, or if a required object in the button's action does not exist at runtime.  Agentry tries to qualify all the action steps tied to the button action before allowing you to press it.  If it determines that something is wrong/missing at runtime, the button will remain disabled.  For instance, you may have a sub-action in your button action that targets: Whatever collection -> First Object.  Agentry will look at that collection when deciding if the button should be enabled.  If there are no rows in that collection, the button will remain disabled, even if another sub-action in that action would have created a row in that collection before it was needed by the step that is failing to meet the target requirement.  How do you get around this problem?  Add an execute rule to sub-actions that may not have their target requirement met until the action runs.  If your execute rule returns false, Agentry will ignore that sub-action step when determining if a button should be enabled for pressing.  In the example case, add an execute rule that checks for the existence of one row:

TYPE

     Whatever collection -> First object

Sometimes debugging these enable/disable target problems can be difficult.  The best way to do this is to copy the suspected bad action and use the copy temporarily, removing or modifying steps until the problem area is found.  Then make corrections to the original action.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Thank you for explanation.


If it determines that something is wrong/missing at runtime, the button will remain disabled.

Suppress and hide errors, bad practice.

Jason, if you have a relationship with the developers of agents, give them my opinion.

Former Member
0 Kudos

The errors are not hidden,  but because the targets are not available, the button gets disabled.  If the targets become available, then it would activite itself.

Former Member
0 Kudos

Targets are not available in Agentry means same as null pointer in Java, isn't it?

So to avoid Access Violation (null pointer), it makes button disabled.

Or it is so intended that the developer make Target unavailable to make Button disabled.

jason_latko
Advisor
Advisor
0 Kudos

Konstantin,

That is a good way to look at it.  It stops the client from crashing because you tried to point to a null pointer.  To answer your other question, when do you need a target on a transaction action step?  Only when the target is different from the object that was passed in to the action.  If you pass a Whatever object into an action with a transaction step that runs an edit transaction against a Whatever object, then you don't need to set the target on the transaction step.  Agentry will automatically use the Whatever object that you passed in to the action.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Jason


It stops the client from crashing because you tried to point to a null pointer.

You treat it as a positive or negative act?

I treat it as a negative act. If the button would be available then crashing means a detial information about Target which caused it. So developer can quickly understand the reason.

Otherwise he must to perform an indefinite number of activities to understand the reason why the button is not available for pressing.

jason_latko
Advisor
Advisor
0 Kudos

Konstantin,

I agree that debugging can be difficult and frustrating at times.  It gets much easier with experience.  The thinking behind that design was to isolate the end user from crashes and cryptic error messages in the field.  The runtime client was not designed a debugging tool.  It was meant to be light weight and have the smallest footprint possible on the device.  This was especially true when Windows PPC clients were the primary OS in the field, and the size of the executable was severely limited.  This isn't likely to change going forward.  Another way to debug such problems is to use the Test Environment in Eclipse and turn on logging for your action.  The log will then show you the cause/source of an action evaluation being terminated.

Jason Latko - Senior Product Developer at SAP