![]() | |
#21
| |||
| |||
|
|
I'm surprised nobody remembered to use REFORMAT. |
|
1. CREATE-FILE TEMP.CUSTOMERS |
|
2. REFORMAT ORDERS WITH ORDER.DATE LE "06/28/08" CUSTOMER.ID This effectively creates a record in the secondary file, whose ID is CUSTOMER.ID |
#22
| |||
| |||
|
|
Being a Friday I can't seem to think. My brain has left for the weekend, so I ask the group: I have a file with customer orders, how would I get a list of customers who have not placed an order in the last three years? |
#23
| |||
| |||
|
|
This is the third attempt for posting this message - don't know why it isn't getting to the group. |
#24
| |||
| |||
|
|
On 2011-06-28 14:40:51 -0400, Matt <mstern (AT) comprehensive (DOT) com> said: I'm surprised nobody remembered to use REFORMAT. Until today, we did not know which version of Pick (revealed as D3/NT) was being used. Not all versions support this verb. However, I agree that REFORMAT / SREFORMAT is an often overlooked Pick verb. 1. CREATE-FILE TEMP.CUSTOMERS Now knowing the Pick version, I would opt for a solution as posted by Tony G., which uses list manipulation. This avoids having to create any extra, temporary files. 2. REFORMAT ORDERS WITH ORDER.DATE LE "06/28/08" CUSTOMER.ID This effectively creates a record in the secondary file, whose ID is CUSTOMER.ID Actually, I believe that syntax will not produce the results you expect. What you've posted will create records in the secondary file with an ID the same as the order ID, and attribute 1 will contain the CUSTOMER.ID. To get items with an ID the same as the CUSTOMER.ID, you need to add ID-SUPP or (I) to the statement. There is a possible downside to this approach too. Since the result is strictly based on the data in the ORDERS file, it will not include any customers that have never placed an order (e.g. new customers). Some would say that if they've never placed an order, they are not a customer, but that depends entirely on the business and what an order represents to that business. -- Kevin Powick |
#25
| |||
| |||
|
|
On 2011-06-29 11:29:18 -0400, JJCSR <JCronin (AT) ktp (DOT) com> said: |
|
This is the third attempt for posting this message - don't know why it isn't getting to the group. I've seen all of your messages come through, but I noticed that posts are missing from the Google's usenet feed for CDP. I use a usenet feed, not google to follow CDP. -- Kevin Powick |
#26
| |||
| |||
|
|
On 2011-06-27 08:23:49 -0400, Rich Taylor <richtaylor0... (AT) gmail (DOT) com> said: The solution proposed by Kevin seems best. Well, I'm not sure about "best", but I intended it to cater to the lowest common denominator of "Pick" type systems. *It "should" work for almost any MV system that's still running today. Without making system modifications or creating new files, list manipulation, as shown in TG's solution, is a better approach. *He's shown how it can be done in D3, and I know that OpenQM has similar TCL verbs to do the same. *I'm not sure about other platforms. -- Kevin Powick |
#27
| |||
| |||
|
|
I dunno if non-D3 flavors have REFORMAT, or if is moot point on account of them already having the features you used above * { * * QSELECT *verb * and (U *option of *GET-LIST * *} but you could instead just write items in a TMP file of the qualifying order dates as mvalues on a1, with item ids in TMP being customer id; * CLEAR-FILE TMP * SELECT ORDERS WITH DATE *> "01/01/2008" * REFORMAT *ORDERS * CUST.ID * DATE * ID-SUPP * * * file name *: ? * *TMP *LIST TMP A1 * * * * * TMP * * * * *A1 * * * * * TOM * * * *15800 * * * * * * * * * * * * * *14904 * * * * * * * * * * * * * *15530 * * * * * DICK * * * 14841 customers tom and dick were found in ORDERS in the DATE range requested. You might want to also preserve associated *ORDERS item ids as TMP A2 ; REFORMAT *ORDERS * *CUST.ID *DATE *A0 *ID-SUPP * * file *name *:? * TMP |
#28
| |||
| |||
|
|
Yes Frank, REFORMAT has existed on all pick versions since the days of SMA. I want to say it was a product of the minds at ADDS but I can't quite be sure on that. |
![]() |
| Thread Tools | |
| Display Modes | |
| |