Thanks for the very detailed, and clear, answer Doug!!
Your participation on the list is, as always, very greatly appreciated

Guillaume

________________________________________
From: Action Request System discussion list(ARSList) [arsl...@arslist.org] on 
behalf of Mueller, Doug [doug_muel...@bmc.com]
Sent: Monday, April 19, 2010 4:39 PM
To: arslist@ARSLIST.ORG
Subject: Re: $LASTCOUNT$ on filters (was: need to design a counter)

Guillaume,

So, since you asked....

The AR System server is a stateless server.  That means that the server itself
does not retain state between API calls (OK, to be perfectly honest, it does
cache a bit of user info for efficiency but if that is lost, it just reloads it
and there is some "chunking" done when passing large data sets..  but
essentially, it is stateless).

So, there is no ability to have any data retained/assumed across API calls in
terms of LASTCOUNT.

However, the LASTCOUNT data is stored in thread local storage (in other words,
there is an information block per thread that stores data for that thread).  So,
within a single API call, across the operations, including all filters, that
are performed within that call, this keyword does have a value.

Note, that if the very first thing you do is have a filter report LASTCOUNT,
you are getting a random, leftover value from whoever was in the thread before
you.

However, once you do a search -- set fields, push fields, table load -- the
LASTCOUNT value will be updated with the count from this search and available
as the keyword for subsequent workflow.

In other words, the keyword works identically on the server within filters as
it does within active links.  HOWEVER, it is within an API call and the value
is searches done within the API call and not any search done on the client
before interaction with the server.   For example, if you loaded a table on
the client and then did a save, the save goes to the server but there is no
value of LASTCOUNT that has the count of the entries loaded in the table on
the client.  If you do an operation on the server within the operation however,
the LASTCOUNT value should be accurate for logic after that table load.

So, the keyword is fully useable in filters as long as it is used within a
single API call.

NOTE: Just like in active links, this is the result of the last search.  So, if
there is other workflow or operations that occur before you try and use the
keyword, other workflow may have done searches that alters the result.  So, it
is critical to use the keyword value immediately after the operation that does
the search.  (i.e. do a push fields filter and there is logic on the target
where you push to that does searches or loads tables.  By the time you return
from the Push fields operation, there have been changes to LASTCOUNT so the
value is no longer a reflection of what was found for the push operation
itself.  Just something to keep in mind.)

Doug

PS -- Just as I was about to hit send, I see that Misi answered the question
correctly based on testing evidence.

-----Original Message-----
From: Action Request System discussion list(ARSList) 
[mailto:arsl...@arslist.org] On Behalf Of Guillaume Rheault
Sent: Monday, April 19, 2010 7:33 AM
To: arslist@ARSLIST.ORG
Subject: $LASTCOUNT$ on filters (was: need to design a counter)

Hi Misi,

My understanding is that it is not recommended to use $LASTCOUNT$ on filters, 
only in active links, because the $LASTCOUNT$ on a filter will be set for the 
last filter action that executed at that point in time, which may not be the 
one that just preceded it.
This is specially true were you have many fast and list servers, so the 
probability of this problem happening is even greater....

Again that's my understanding, so I could be wrong. So therefore anytime that I 
need to count for records, I prefer to use the select count(*), or even better 
select count(request_id)  or select count(rowid) on oracle databases.
I only use the $LASTCOUNT$ keyword on active links, since active links actions 
are always serially executed as you know.

Maybe somebody at BMC (Doug or David Easter) can confirm what actually happens 
with $LASTCOUNT$ on a filter in an a server that has multiple fast and list 
servers configured and many operations are always executing, either by the 
system (escalations, assignment engine, approval server, etc) or by users.

For more than 10 years, I have never gotten a clear answer on this issue. Plus 
of course the internal ARS design may have changed between ARS versions, so 
whatever somebody thought was true  on ARS 4.0 may have been incorrect in ARS 
6.0

Guillaume

________________________________________
From: Action Request System discussion list(ARSList) [arsl...@arslist.org] on 
behalf of Misi Mladoniczky [...@rrr.se]
Sent: Friday, April 16, 2010 5:12 AM
To: arslist@ARSLIST.ORG
Subject: Re: need to design a counter

Hi,

Why not keep away from direct-sql when it is not absolutely neccessary?

FLTR
  ACTION
    SET-FIELDS from FormX ('1' > "0")
      myResult = $1$
  ACTION
    SET-FIELDS from CURRENT TRANSACTION
      myResult = $LASTCOUNT$

Best Regards - Misi, RRR AB, http://www.rrr.se

Products from RRR Scandinavia:
* RRR|License - Not enough Remedy licenses? Save money by optimizing.
* RRR|Log - Performance issues or elusive bugs? Analyze your Remedy logs.
Find these products, and many free tools and utilities, at http://rrr.se.

> Raj,
>
> What is the reason you need that counter? Just to have a total count of
> tickets in form 1?? Or is there another reason?
>
> If you just want a count, I wouldn't create a form. I would have a hidden
> field that did a select count(*) from whatever view name that table has in
> the underlying database..
>
> Cheers
>
> Joe
>
> -----Original Message-----
> From: Action Request System discussion list(ARSList)
> [mailto:arsl...@arslist.org]on Behalf Of Raj
> Sent: Thursday, April 15, 2010 8:04 PM
> To: arslist@ARSLIST.ORG
> Subject: need to design a counter
>
>
> Hello all,
> There is an integer field on form1.
> need to design a counter which increments the count by one for every
> submit on form2.
> So, need to write a filter on submit of form 2 which increments the
> integer field on form 1 by 1 for every submit on form 2.please advise.
> thanks,
> Raj
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
> attend wwrug10 www.wwrug.com ARSlist: "Where the Answers Are"
>
> --
> This message was scanned by ESVA and is believed to be clean.
>

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug10 www.wwrug.com ARSlist: "Where the Answers Are"

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug10 www.wwrug.com ARSlist: "Where the Answers Are"

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug10 www.wwrug.com ARSlist: "Where the Answers Are"

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug10 www.wwrug.com ARSlist: "Where the Answers Are"

Reply via email to