• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Validation for accumulation of items.

I am attempting to write a data file that can only contain up to one entity of unique ID Gate. When writing a validation rule for this I am encoutnering problems.
I have tried using both unit and item entities called Gate and assigned a tag of Spec.Gate. Then I used the following code in a validation rule of scope roster:

if (tagcount[Spec.Gate] <= 1) then
@valid = 1
endif


Army Builder then compiles this, but no validation error occurs if two or more Gates are included.

Then i tried using the following (obviously swapping unit for item depending upon which entity type I was using):

var x as number
x = tally[unit:Spec.Gate&convert.validate]
if (x <= 1) then
@valid = 1
endif



However Army Builder is still not returning a validation error when 2 Gates are selected.

Has anyone got any advice for me because I seem to be hitting a brick wall.
 
You were almost correct with your first attempt. The one thing you omitted was designating the tag group to be "accrued". If you don't do this, the tag is assigned to the entity and that's the only place it will be found. However, if you DO mark the group as "accrued", the tags from that group will be propogated to their container(s) and the overall roster. Once you do that, your rule below should work.

The use of accrued tags is critical in many data files. I recommend you review the docs on accrued tags so that you fully understand how they can be used. There's a LOT to digest for writing AB data files, and this is one topic that warrants a re-read due to its importance. :-)

Also, there are a bunch of debugging aids within AB that can help you to determine what the source of a problem actually is. For example, you could use the aids for viewing tags to verify that the tag was showing up for the entities but not for the overall roster. This could eliminate the rule as the source of the problem and help focus in on the true source. For more details, see the "Getting Started" chapter in the Kit docs and refer to the "Debugging Tools Within Army Builder" section.

Hope this helps,
Rob

At 09:50 PM 3/11/2006, you wrote:

I am attempting to write a data file that can only contain up to one entity of unique ID Gate. When writing a validation rule for this I am encoutnering problems.
I have tried using both unit and item entities called Gate and assigned a tag of Spec.Gate. Then I used the following code in a validation rule of scope roster:

if (tagcount[Spec.Gate] <= 1) then
@valid = 1
endif

Army Builder then compiles this, but no validation error occurs if two or more Gates are included.

Then i tried using the following (obviously swapping unit for item depending upon which entity type I was using):

var x as number
x = tally[unit:Spec.Gate&convert.validate]
if (x <= 1) then
@valid = 1
endif


However Army Builder is still not returning a validation error when 2 Gates are selected.

Has anyone got any advice for me because I seem to be hitting a brick wall.
 
Excellent. Thanks for that. this is what happens when you plow ahead without fully understanding the documentation!

Hopefully there won't be many more problems!
 
Back
Top