Sytze de Boer wrote on 2012-09-17: 
>  This is probably a dumb question but I'll risk it
>  
>  During a SELECT FROM, I can do a SUM(QTY) as TTLQTY
>  I want to combine the CHARACTERS from the select statement into either a
>  memo or wide character field
>  Is this possible?
>

Sytze,

Meaning you have a table that consists of these records
Id, Key, String
1, Code, Combine
2, Code, This
3, Code, Text

You want to end up with a result being
Key, String
Code, Combine This Text

???

Expect Strange behavior!

PRIVATE CallNumber
CallNumber = 0
CLOSE TABLES ALL 
CREATE CURSOR c1 (id i, key c(4), string c(10))
INSERT INTO c1 VALUES (1, "code", "Combine")
INSERT INTO c1 VALUES (2, "code", "this")
INSERT INTO c1 VALUES (3, "code", "text")

Select Key, MAX(Cast(Udf(c1.Key, c1.string) as c(100))) as string FROM c1
group by key

Function Udf
Lpar tKey, tString
CallNumber = CallNumber + 1 
If not used("udfcursor") 
   Create CURSOR udfcursor (key c(4), string m)
   Index on key tag key
Endif
If seek(tkey, "udfcursor", "key")
   IF ALLTRIM(udfcursor.string) != ALLTRIM(tString)
      Replace string with String + " " +ALLTRIM(tString) + "(" +
TRANSFORM(CallNumber) + ")" next 1
   ENDIF 
Else
   Insert into udfcursor values (tkey, ALLTRIM(tString) + "(" +
TRANSFORM(CallNumber) + ")")
Endif
Return udfcursor.string



Tracy Pearson
PowerChurch Software


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to