Page 1 of 1

How count not numeric value?

Posted: Mon Oct 11, 2010 7:28 am
by Eric Debrosse
Hi,

I have two problems in my report projet
First
Is it possible to count not data numéric.
In my report i have string data and numéric like that

Name Contact Type of contact
xxxx Visite Vente
AAAA Visite RAF

Total Vente :
Total RAF :

I would like :
i would like the number of "visite" = "vente" or RAF ………

I don't know to do that. Jan, have you exemples with conditions?

Second
when i print my report the margins is not good. Text is troncate.

Best regards

Re: How count not numeric value?

Posted: Mon Oct 11, 2010 9:04 pm
by JanSchenkel
Hi Eric,

Let's start with your 'count' question. The first solution I can think of, is to define a helper function in another library stack or backscript:

Code: Select all

function OneIfEquals pCompareWhat, pCompareTo
  if pCompareWhat is pCompareTo
  then return 1
  else return 0
end OneIfEquals
Then you can use this helper function to track the total for each distinct group. Assuming that the 'Type of contact' is a column 'TypeOfContact' in a database cursor, you would then place two fields in the report summary band:

Code: Select all

OneIfEquals(TypeOfContact, "Vente")
and

Code: Select all

OneIfEquals(TypeOfContact, "RAF")
And set the Aggregate function to 'Sum' - leaving the reset at 'End of report'

As for your second question, on which operating system does this happen (Windows, MacOSX, Linux) and which version of Revolution/LiveCode ?
Does the truncate also happen in the on-screen preview, or only when printing?

Jan Schenkel.

Re: How count not numeric value?

Posted: Thu Feb 24, 2011 8:32 pm
by JosepM
Hi Jan,

Can I expand with my own functions? :shock: Where I must save these functions? a stack library like other function and be called inside the field report?

Salut,
Josep

Re: How count not numeric value?

Posted: Fri Feb 25, 2011 6:08 am
by JanSchenkel
Hi Josep,

You can use just about any custom function, as long as it is 'behind' the qrtReportsLib stack in the message path - and as qrtReportsLib is a library stack, this means your custom function should be part of the stack script of another stack that you load as a library by means of the start using command, or part of the script of an object that you add to the backscripts by means of the insert script command.
The message path can be a truly wonderful thing :-)

HTH,

Jan Schenkel.