Now I understand, you are using the query in the Condition formula. I
thought you were using the 4GL code of the Action.
Have you tried setting the condition
the ttPart.SNPrefix field has been changed from "" to any
and number of rows in the 'test' query is not less than 1
'test' being something like.
for each ttpart where ttpart.RowMod = 'U' or ttpart.RowMod = 'A'
first part where part.Company = ttpart.Company and part.SNPrefix =
ttpart.SNPrefix
That should limit it to when someone changes or creates an new the
record (save) and only when they have changed the SNPrefix, and then
find the first part with a matching prefix and trigger your Action.
I don't use SN here, but let me know the results.
Best of luck,
Aaron
Mark Wonsil wrote:
thought you were using the 4GL code of the Action.
Have you tried setting the condition
the ttPart.SNPrefix field has been changed from "" to any
and number of rows in the 'test' query is not less than 1
'test' being something like.
for each ttpart where ttpart.RowMod = 'U' or ttpart.RowMod = 'A'
first part where part.Company = ttpart.Company and part.SNPrefix =
ttpart.SNPrefix
That should limit it to when someone changes or creates an new the
record (save) and only when they have changed the SNPrefix, and then
find the first part with a matching prefix and trigger your Action.
I don't use SN here, but let me know the results.
Best of luck,
Aaron
Mark Wonsil wrote:
>[Non-text portions of this message have been removed]
> > Below is the code that I call from within the ReportQty.ReportQty Method
> > PreProcess...
> > Condition: the ReportQty.CurrentQty field of the changed row is not
> > equal to the 0 value
> > Action: synchronously execute 4GL /* Define the Variables */ ... record
> > nothing
>
> <cool_stuff_snipped/>
>
> > It's not pretty, but I assure you this code works every time. I don't
> > start with a For... where are you creating your code that it is
> > requiring it?
>
> Excellent example Aaron but maybe I've been a little dense in explaining
> what I'm trying to do. So here's a little background. Our serial number
> system is straight forward: a serial number must be unique for each
> product
> sent out the door. As you know, in Vantage, one serial number can be
> assigned to different parts. That's fine. I'm sure that provides essential
> functionality to others. In order to make serial numbers unique, we want a
> business rule that says "Each serialized part must have a unique prefix".
> That is the only way that we know how we can ensure that no two parts will
> share a serial number. (Open to ideas if there's another way around this.)
> Sure as heck, the users have been reusing prefixes on different parts and
> two different products now have the same serial number. I think to myself,
> "Hey, wouldn't a BPM be a great way to catch these errors? There are
> several
> areas where one can change the prefix of a serial number on a part and
> a BPM
> would catch them all."
>
> So I start out with the knowledge that the Serial Number Prefix is
> stored on
> the Part. I create a Pre-Processing Method Directive for the Part.Update
> method. I looked through the available conditions and think that
> "number of
> rows in the designed query is more than 0" fits the best if the designed
> query is "show me all of the parts (not including the current part) that
> match the SNPrefix of the part I am maintaining". If I find one record
> that
> matches this condition, I want to display a message and cancel the update.
>
> In the condition "number of rows in the designed query is more than 0", I
> click on the word 'designed' and a Compose Query window appears. It is
> here
> that Vantage requires that the query begin with a FOR [EACH | FIRST |
> LAST].
> The Compose Query window is equipped with a data dictionary and will
> auto-complete field names for those record/buffers in the FOR clause. One
> can also insert BAQ constants. Very cool really. So I enter my query
> (and I
> think my lack of Progress is hurting me here) which is:
>
> FOR EACH ttPart, FIRST Part WHERE ttPart.Company = Part.Company AND
> ttPart.PartNum <> Part.PartNum AND ttPart.SNPrefix = Part.SNPrefix
>
> I *think* this query should retrieve the first Part record that
> matches the
> SNPrefix but not for the Part that I'm currently maintaining. If so, the
> user is trying to enter a duplicate SNPrefix that exists for another
> part.
>
> If that condition holds, my action is to "raise exception based on the
> designed template", which should prevent the operation from continuing.
> (Right?)
>
> Now I'm fairly sure there's an error in my Query because my BPM Action
> sometimes fires even though there is no matching record and sometimes
> doesn't fire when there is a matching record. (I have a BAQ that searches
> the Part table to verify existence of a particular SNPrefix.)
>
> I appreciate any thoughts this august gang might have.
>
> Thanks,
>
> Mark W.
>
>