forked from consultingwerk/CCS_Samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
get-customer-by-querystring.p
77 lines (58 loc) · 2.77 KB
/
get-customer-by-querystring.p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**********************************************************************
* Copyright (C) 2006-2016 by Consultingwerk Ltd. ("CW") - *
* www.consultingwerk.de and other contributors as listed *
* below. All Rights Reserved. *
* *
* Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY *
* KIND, either express or implied. *
* *
* Contributors: *
* *
**********************************************************************/
/*------------------------------------------------------------------------
File : get-customer-by-querystring.p
Purpose : fetches customer records by query string
Syntax :
Description :
Author(s) :
Created : Wed Jun 22 02:45:08 CEST 2016
Notes :
----------------------------------------------------------------------*/
/* *************************** Definitions ************************** */
BLOCK-LEVEL ON ERROR UNDO, THROW.
USING Ccs.BusinessLogic.* FROM PROPATH.
USING Ccs.Common.* FROM PROPATH.
USING Consultingwerk.CcsSamples.BusinessEntity.* FROM PROPATH.
USING Consultingwerk.CcsSamples.Framework.BusinessLogic.* FROM PROPATH.
DEFINE VARIABLE oCustomerEntity AS IBusinessEntity NO-UNDO .
DEFINE VARIABLE i AS INTEGER NO-UNDO .
{Consultingwerk/CcsSamples/BusinessEntity/Customer/dsCustomer.i}
/* *************************** Main Block *************************** */
RUN Consultingwerk/CcsSamples/boot.p .
oCustomerEntity = CAST (Application:ServiceManager:getService(GET-CLASS (IBusinessEntity),
BusinessEntities:Customer:ToString()),
IBusinessEntity) .
oCustomerEntity:getData (NEW GetDataRequest("eCustomer", "SalesRep = 'HXM' AND Name BEGINS 'Li'"),
OUTPUT DATASET dsCustomer) .
FOR EACH eCustomer:
i = i + 1 .
END.
MESSAGE "results:" i
VIEW-AS ALERT-BOX.
FOR EACH eCustomer:
DISPLAY eCustomer.CustNum
eCustomer.Name
eCustomer.SalesRep WITH DOWN .
END.
// Error handling
CATCH apperr AS Progress.Lang.AppError :
MESSAGE apperr:GetMessage(1) SKIP
apperr:ReturnValue SKIP (2)
apperr:CallStack
VIEW-AS ALERT-BOX.
END CATCH.
CATCH err AS Progress.Lang.Error :
MESSAGE err:GetMessage(1) SKIP (2)
err:CallStack
VIEW-AS ALERT-BOX.
END CATCH.