MARS Query 'Hit-Count' versus 'Total-Count'
Hi, I have a question about MARS queries: I run queries using 'custom columns' and I continually hit over 5000 entries. I was wondering if there is a way to show the following:
Custom Colums:
- event type set
- source IP address
- destination IP address, port, and protocol
- <NEW FIELD> 'Hit-count'
The reason I posit the 'Hit-count' field is that this would help me see everything that happened on the first three columns and not limit me when MARS says 'only the first 5000 entries will be displayed'.
If there is any way to count the number of times it happened in a hit-count field, versus counting the number of times it happened and then limiting the displayed results, I would think that would be tremendously useful.
Please let me know if there is already a way to do this, or if there are any plans to add this! Thanks!
Don't know about queries, but you define 'Count' in MARS rules, so you could clone the built-in rule and perhaps modify the count value to suit your needs. I know this is not exactly what you are looking for but it might get you going in the right direction. You also have the following variables to play with to further suit your needs:
ANY-(Default). Signifies that the IP address for each count is any IP address.
SAME-Signifies that the IP address for each count is the same IP address. This variable is local to its offset.
DISTINCT- Signifies that the IP address for each count is a unique IP address. This variable is local to its offset.
$Target01 to $Target20-The same variable in another field or offset signifies that the IP address for each count is the same IP address.
Have a look at:
http://ciscosystems.com/univercd/cc/td/doc/product/vpn/ciscosec/mars/5_3/uglc/rules.htm#wp1054961
Also on strange idea, but it might work, in the "Maximum Number of Rows Returned" why don't you try and put 1000, does the MARS accept that? I seriously doubt it would work, but worth a try. I think they used to have an even lower limit in older version (1000).
Regards
Farrukh
Similar Messages
-
Folders' item count versus file count.
At the risk of making a comparison to Windows, it has a default behavior that provides more detailed information.
In the example below, with Mavericks and Windows 7 in Parallels, I "Get Info" and show "Properties" on the same Music folder, respectively.
As you can see, Windows breaks it down to Files and Folders, whereas Mavericks only shows an Item count.
Is there a setting to toggle in Mavericks to provide this level of detail?
Is there a third party plug-in that is recommended that can accomplish the same thing?You get what you see.
-
Need to get total count of a column in the given query
Hi,
I have the following query for which i need a total count of distinct concatenated_address. I am trying to use count(distinct adv.concatenated_address) in the below query but because of the group by it does not give me the expected result.
I am not reusing the same query, in my program again, to get the count as it would affect the performance. This query takes really long to execute and so is there a way to incorporate the count in this single query itself without having to use it twice.
SELECT DISTINCT (acv.customer_name||','||
acv.customer_number||','||
REPLACE(adv.concatenated_address, ',', ' ')||','||
adv.postal_code||','||
rct.interface_header_attribute1||','||
rct.interface_header_attribute6||','||
rct.creation_date||','||
rct.trx_date||','||
aps.due_date ||','||
SUM(aps.amount_due_original)||','||
SUM(aps.amount_due_remaining) ||','||
rct.printing_count ||','||
TO_DATE(rct.printing_last_printed)||','||
TO_DATE(rct.printing_original_date)||',') str
,acv.customer_id
,REPLACE(adv.concatenated_address, ',', ' ') address
FROM ar_customers_v acv
,ar_addresses_v adv
,hz_cust_site_uses hcsu
,ra_customer_trx rct
,ar_payment_schedules aps
WHERE adv.customer_id = acv.customer_id
AND hcsu.cust_acct_site_id = adv.address_id
AND hcsu.site_use_code = 'BILL_TO'
AND rct.bill_to_customer_id = acv.customer_id
AND rct.bill_to_site_use_id = hcsu.site_use_id
AND aps.customer_trx_id = rct.customer_trx_id
GROUP BY acv.customer_name
,acv.customer_number
,adv.concatenated_address
,adv.postal_code
,rct.interface_header_attribute1
,rct.interface_header_attribute6
,rct.creation_date
,rct.trx_date
,aps.due_date
,rct.printing_count
,TO_DATE(rct.printing_last_printed)
,TO_DATE(rct.printing_original_date)
,acv.customer_id
ORDER BY acv.customer_id
,REPLACE(adv.concatenated_address, ',', ' ')
Thank youtry this please
SELECT COUNT(str),customer_id
FROM
(SELECT DISTINCT (acv.customer_name||','||
acv.customer_number||','||
REPLACE(adv.concatenated_address, ',', ' ')||','||
adv.postal_code||','||
rct.interface_header_attribute1||','||
rct.interface_header_attribute6||','||
rct.creation_date||','||
RCT.TRX_DATE||','||
aps.due_date ||','||
SUM(aps.amount_due_original)||','||
SUM(aps.amount_due_remaining) ||','||
rct.printing_count ||','||
TO_DATE(rct.printing_last_printed)||','||
TO_DATE(rct.printing_original_date)||',') str
,acv.customer_id
,REPLACE(adv.concatenated_address, ',', ' ') address
FROM ar_customers_v acv
,ar_addresses_v adv
,hz_cust_site_uses hcsu
,ra_customer_trx rct
,ar_payment_schedules aps
WHERE adv.customer_id = acv.customer_id
AND hcsu.cust_acct_site_id = adv.address_id
AND hcsu.site_use_code = 'BILL_TO'
AND rct.bill_to_customer_id = acv.customer_id
AND rct.bill_to_site_use_id = hcsu.site_use_id
AND aps.customer_trx_id = rct.customer_trx_id
GROUP BY acv.customer_name
,acv.customer_number
,adv.concatenated_address
,adv.postal_code
,rct.interface_header_attribute1
,rct.interface_header_attribute6
,rct.creation_date
,rct.trx_date
,aps.due_date
,rct.printing_count
,TO_DATE(rct.printing_last_printed)
,TO_DATE(RCT.PRINTING_ORIGINAL_DATE)
,ACV.CUSTOMER_ID) -
Counting Record Totals Within Query: Totals Output to New Table
Hi All,
I'm failry new to PL/SQL... my apologies if this is obvious... I'm trying to count the total number of BI_WRKFLW.BI_LMN_SRV_AREA occurences by each BI_WRKFLW.BI_LMN_SRV_AREA (The Code correspondes to a city name like Sundance, Sheridan, Etc.)
So, I have a Query that executes fine:
Query
/* Begin Querey */
SELECT DISTINCT
"BI_SO_DET_VIEW_1"."BI_SO_STAT_CD",
"BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED",
"BI_TYPE_SERVICE"."BI_ACCT",
"BI_SO_DET_VIEW_1"."BI_SO_NBR",
"BI_LMN_SRV_REF"."BI_LMN_SRV_DESC",
"BI_SO_TYPE_REF"."BI_SO_TYPE_DESC",
"BI_SRV_STAT_REF"."BI_SRV_STAT_DESC",
"BI_DIST_OFC_REF"."BI_DIST_NAME",
"BI_CNTY_REF"."BI_COUNTY_DESC",
"BI_SO_DET_VIEW_1"."BI_CLOSE_DT",
"BI_WRKFLW_TASKS"."BI_EVENT_DT_TM",
"BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD",
"BI_LMN_SRV_REF"."BI_LMN_SRV_AREA",
"BI_SO_MASTER"."BI_WO_WORKORD"
FROM
((((((((("XXXXXX"."BI_SO_MASTER" "BI_SO_MASTER"
LEFT OUTER JOIN
"XXXXXX"."BI_SO_DET_VIEW_1" "BI_SO_DET_VIEW_1"
ON
"BI_SO_MASTER"."BI_SO_NBR"="BI_SO_DET_VIEW_1"."BI_SO_NBR")
LEFT OUTER JOIN
"XXXXXX"."BI_TYPE_SERVICE" "BI_TYPE_SERVICE"
ON
"BI_SO_DET_VIEW_1"."ACCT_NBR"="BI_TYPE_SERVICE"."BI_ACCT")
LEFT OUTER JOIN
"XXXXXX"."BI_WRKFLW" "BI_WRKFLW"
ON
"BI_SO_DET_VIEW_1"."BI_WRKFLW_KEY"="BI_WRKFLW"."BI_WRKFLW_KEY")
LEFT OUTER JOIN
"XXXXXX"."BI_SO_TYPE_REF" "BI_SO_TYPE_REF"
ON
"BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"="BI_SO_TYPE_REF"."BI_SO_TYPE_CD")
LEFT OUTER JOIN
"XXXXXX"."BI_WRKFLW_TASKS" "BI_WRKFLW_TASKS"
ON
"BI_WRKFLW"."BI_WRKFLW_KEY"="BI_WRKFLW_TASKS"."BI_WRKFLW_KEY")
AND (
"BI_WRKFLW"."BI_WORK_EVENT_CD"="BI_WRKFLW_TASKS"."BI_WORK_EVENT_CD"))
LEFT OUTER JOIN
"XXXXXX"."BI_DIST_OFC_REF" "BI_DIST_OFC_REF"
ON
"BI_WRKFLW"."BI_DIST_OFC_CD"="BI_DIST_OFC_REF"."BI_DIST_OFC_CD")
LEFT OUTER JOIN
"XXXXXX"."BI_LMN_SRV_REF" "BI_LMN_SRV_REF"
ON
"BI_WRKFLW"."BI_LMN_SRV_AREA"="BI_LMN_SRV_REF"."BI_LMN_SRV_AREA")
LEFT OUTER JOIN
"XXXXXX"."BI_SRV_LOC" "BI_SRV_LOC"
ON
"BI_TYPE_SERVICE"."BI_SRV_LOC_NBR"="BI_SRV_LOC"."BI_SRV_LOC_NBR")
LEFT OUTER JOIN
"XXXXXX"."BI_SRV_STAT_REF" "BI_SRV_STAT_REF"
ON
"BI_TYPE_SERVICE"."BI_SRV_STAT_CD"="BI_SRV_STAT_REF"."BI_SRV_STAT_CD")
LEFT OUTER JOIN
"XXXXXX"."BI_CNTY_REF" "BI_CNTY_REF"
ON
"BI_SRV_LOC"."BI_CNTY_CD"="BI_CNTY_REF"."BI_CNTY_CD"
WHERE
"BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='001'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='001NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='010'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='010NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='011'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='011NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='020'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='020NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='030'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='040'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='041'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='050'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='050A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='051'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='051A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='080'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='085'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='085NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='108'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='140'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='141'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='400'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='401'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='450'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='450A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='451'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='451A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='452'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='452A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='453'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='453A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='460'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='RHR'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='RHRNS')
AND "BI_SO_DET_VIEW_1"."BI_SO_STAT_CD"='O'
AND (
"BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='ANNEXATION'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='AVIAN'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CAPVERIF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CBMRETIRE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CBMSERVCHG'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CONTSERVD'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CUSTBLD'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CUTOFF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='DVCM'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='ENERGIZE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='EQUIPCHANG'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='EQUIPVALID'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='HIGHLOAD'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='LOCATE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='MAINT-EQ'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='MSYSTEMMGT'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='NCBM'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='NEWRES-WF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='NEW-WF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='POWER QUAL'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='RECONIDLE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='RECVERIF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='RETIRE1'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='RETIRE2'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='SERVCHANGE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='SPECIALPRJ'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='SUBD'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='SYSTEMMGT'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='TREE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='TRFX')
ORDER BY
"BI_LMN_SRV_REF"."BI_LMN_SRV_DESC" DESC,
"BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"
/* End Querey */That is wrapped within a counting Block that is giving me trouble:
SELECT
WOCOUNT.Office,
WOCOUNT.WOCOUNT
FROM
SELECT
CASE
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '1'
THEN '1-SUNDANCE'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '2'
THEN '2-GILLETTE'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '3'
THEN '3-SHERIDAN'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '4'
THEN '4-West/Central'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '5'
THEN '5-East/Central'
ELSE '0-OTHER'
END AS Office,
COUNT (T1.BI_LMN_SRV_AREA ) AS WOCOUNT
FROM
/* Begin Querey */
/* End Querey */
) T2
JOIN
BI_SO_DET_VIEW_1
ON
T2.BI_WRKFLW_KEY = BI_SO_DET_VIEW_1.BI_WRKFLW_KEY
GROUP BY
BI_WRKFLW.BI_LMN_SRV_AREA
)WOCOUNTThis is the 2 blocks together:
SELECT
WOCOUNT.Office,
WOCOUNT.WOCOUNT
FROM
SELECT
CASE
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '1'
THEN '1-SUNDANCE'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '2'
THEN '2-GILLETTE'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '3'
THEN '3-SHERIDAN'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '4'
THEN '4-West/Central'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '5'
THEN '5-East/Central'
ELSE '0-OTHER'
END AS Office,
COUNT (T1.BI_LMN_SRV_AREA ) AS WOCOUNT
FROM
/* Begin Querey */
SELECT DISTINCT
"BI_SO_DET_VIEW_1"."BI_SO_STAT_CD",
"BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED",
"BI_TYPE_SERVICE"."BI_ACCT",
"BI_SO_DET_VIEW_1"."BI_SO_NBR",
"BI_LMN_SRV_REF"."BI_LMN_SRV_DESC",
"BI_SO_TYPE_REF"."BI_SO_TYPE_DESC",
"BI_SRV_STAT_REF"."BI_SRV_STAT_DESC",
"BI_DIST_OFC_REF"."BI_DIST_NAME",
"BI_CNTY_REF"."BI_COUNTY_DESC",
"BI_SO_DET_VIEW_1"."BI_CLOSE_DT",
"BI_WRKFLW_TASKS"."BI_EVENT_DT_TM",
"BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD",
"BI_LMN_SRV_REF"."BI_LMN_SRV_AREA",
"BI_SO_MASTER"."BI_WO_WORKORD"
FROM
((((((((("XXXXXX"."BI_SO_MASTER" "BI_SO_MASTER"
LEFT OUTER JOIN
"XXXXXX"."BI_SO_DET_VIEW_1" "BI_SO_DET_VIEW_1"
ON
"BI_SO_MASTER"."BI_SO_NBR"="BI_SO_DET_VIEW_1"."BI_SO_NBR")
LEFT OUTER JOIN
"XXXXXX"."BI_TYPE_SERVICE" "BI_TYPE_SERVICE"
ON
"BI_SO_DET_VIEW_1"."ACCT_NBR"="BI_TYPE_SERVICE"."BI_ACCT")
LEFT OUTER JOIN
"XXXXXX"."BI_WRKFLW" "BI_WRKFLW"
ON
"BI_SO_DET_VIEW_1"."BI_WRKFLW_KEY"="BI_WRKFLW"."BI_WRKFLW_KEY")
LEFT OUTER JOIN
"XXXXXX"."BI_SO_TYPE_REF" "BI_SO_TYPE_REF"
ON
"BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"="BI_SO_TYPE_REF"."BI_SO_TYPE_CD")
LEFT OUTER JOIN
"XXXXXX"."BI_WRKFLW_TASKS" "BI_WRKFLW_TASKS"
ON
"BI_WRKFLW"."BI_WRKFLW_KEY"="BI_WRKFLW_TASKS"."BI_WRKFLW_KEY")
AND (
"BI_WRKFLW"."BI_WORK_EVENT_CD"="BI_WRKFLW_TASKS"."BI_WORK_EVENT_CD"))
LEFT OUTER JOIN
"XXXXXX"."BI_DIST_OFC_REF" "BI_DIST_OFC_REF"
ON
"BI_WRKFLW"."BI_DIST_OFC_CD"="BI_DIST_OFC_REF"."BI_DIST_OFC_CD")
LEFT OUTER JOIN
"XXXXXX"."BI_LMN_SRV_REF" "BI_LMN_SRV_REF"
ON
"BI_WRKFLW"."BI_LMN_SRV_AREA"="BI_LMN_SRV_REF"."BI_LMN_SRV_AREA")
LEFT OUTER JOIN
"XXXXXX"."BI_SRV_LOC" "BI_SRV_LOC"
ON
"BI_TYPE_SERVICE"."BI_SRV_LOC_NBR"="BI_SRV_LOC"."BI_SRV_LOC_NBR")
LEFT OUTER JOIN
"XXXXXX"."BI_SRV_STAT_REF" "BI_SRV_STAT_REF"
ON
"BI_TYPE_SERVICE"."BI_SRV_STAT_CD"="BI_SRV_STAT_REF"."BI_SRV_STAT_CD")
LEFT OUTER JOIN
"XXXXXX"."BI_CNTY_REF" "BI_CNTY_REF"
ON
"BI_SRV_LOC"."BI_CNTY_CD"="BI_CNTY_REF"."BI_CNTY_CD"
WHERE
"BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='001'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='001NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='010'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='010NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='011'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='011NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='020'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='020NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='030'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='040'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='041'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='050'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='050A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='051'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='051A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='080'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='085'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='085NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='108'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='140'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='141'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='400'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='401'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='450'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='450A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='451'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='451A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='452'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='452A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='453'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='453A'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='460'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='RHR'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='RHRNS')
AND "BI_SO_DET_VIEW_1"."BI_SO_STAT_CD"='O'
AND (
"BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='ANNEXATION'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='AVIAN'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CAPVERIF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CBMRETIRE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CBMSERVCHG'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CONTSERVD'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CUSTBLD'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='CUTOFF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='DVCM'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='ENERGIZE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='EQUIPCHANG'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='EQUIPVALID'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='HIGHLOAD'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='LOCATE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='MAINT-EQ'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='MSYSTEMMGT'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='NCBM'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='NEWRES-WF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='NEW-WF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='POWER QUAL'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='RECONIDLE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='RECVERIF'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='RETIRE1'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='RETIRE2'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='SERVCHANGE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='SPECIALPRJ'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='SUBD'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='SYSTEMMGT'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='TREE'
OR "BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"='TRFX')
ORDER BY
"BI_LMN_SRV_REF"."BI_LMN_SRV_DESC" DESC,
"BI_SO_DET_VIEW_1"."BI_SO_TYPE_CD"
/* End Querey */
) T2
JOIN
BI_SO_DET_VIEW_1
ON
T2.BI_WRKFLW_KEY = BI_SO_DET_VIEW_1.BI_WRKFLW_KEY
GROUP BY
BI_WRKFLW.BI_LMN_SRV_AREA
)WOCOUNTThe last error I received is: [Error Code: 904, SQL State: S0022] [Oracle][ODBC][Ora]ORA-00904: "T2"."BI_WRKFLW_KEY": invalid identifier
I want the final Output to be something similar to:
OFFICE WOCOUNT
0-OTHER 44.0
1-SUNDANCE 14.0
2-GILLETTE 29.0
3-SHERIDAN 11.0
4-West/Central 37.0
5-East/Central 58.0 Thanks for your help,
:) JohnHi, John,
Johnbr (Oracle11G) wrote:
Hi All,
I'm failry new to PL/SQL... That's okay; there's no PL/SQL involved in this problem, and there's no PL/SQL needed, only SQL.
That is wrapped within a counting Block that is giving me trouble:
SELECT
WOCOUNT.Office,
WOCOUNT.WOCOUNT
FROM
SELECT
CASE
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '1'
THEN '1-SUNDANCE'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '2'
THEN '2-GILLETTE'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '3'
THEN '3-SHERIDAN'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '4'
THEN '4-West/Central'
WHEN "BI_WRKFLW"."BI_LMN_SRV_AREA" = '5'
THEN '5-East/Central'
ELSE '0-OTHER'
END AS Office,
COUNT (T1.BI_LMN_SRV_AREA ) AS WOCOUNT
FROM
/* Begin Querey */
/* End Querey */
) T2
JOIN
BI_SO_DET_VIEW_1
ON
T2.BI_WRKFLW_KEY = BI_SO_DET_VIEW_1.BI_WRKFLW_KEY
GROUP BY
BI_WRKFLW.BI_LMN_SRV_AREA
)WOCOUNT
The sub-query called wocount only involves 2 "tables", namely
(1) T2
(2) BI_SO_DET_VIEW_1
(I put "tables" in quotes because T2 isn't really a table; it's an in-line view. Judging by the name, I'm guessing BI_SO_DET_VIEW_1 isn't really a table, either, but it doesn't matter. You have 2 things that serve as tables, so I'll just call them tables.)
Since those are the only 2 tables, you can't reference BI_WRKFLW in WOCOUNT. That table is known inside T2, but not outside of T2.
You can include "BI_WRKFLW"."BI_LMN_SRV_AREA" in the SELECT clause of T2, assuming that doesn't make more rows distinct. T2 will then look like this:
... SELECT DISTINCT
BI_SO_DET_VIEW_1.BI_SO_STAT_CD
BI_SO_MASTER.BI_WO_WORKORD,
BI_WRKFLW.BI_LMN_SRV_AREA -- New column added
FROM ...Then, inside WOCOUNT, you can use BI_LMN_SRV_AREA like this:
... CASE
WHEN BI_LMN_SRV_AREA = '1'
THEN '1-SUNDANCE'
WHEN BI_LMN_SRV_AREA = '2'
THEN '2-GILLETTE'
WHEN BI_LMN_SRV_AREA = '3'
THEN '3-SHERIDAN'
WHEN BI_LMN_SRV_AREA = '4'
THEN '4-West/Central'
WHEN BI_LMN_SRV_AREA = '5'
THEN '5-East/Central'
ELSE '0-OTHER'
END AS Office,or, to save a little typing:
... CASE BI_LMN_SRV_AREA
WHEN '1'
THEN '1-SUNDANCE'
WHEN '2'
THEN '2-GILLETTE'
WHEN '3'
THEN '3-SHERIDAN'
WHEN '4'
THEN '4-West/Central'
WHEN '5'
THEN '5-East/Central'
ELSE '0-OTHER'
END AS Office,
Speaking of saving on typing:
Instead of
WHERE
"BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='001'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='001NS'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='010'
OR "BI_TYPE_SERVICE"."BI_PRIM_RATE_SCHED"='RHRNS'
)you can use the IN operator, like this:
WHERE BI_TYPE_SERVICE.BI_PRIM_RATE_SCHED IN ('001', '001NS', '010', ..., 'RHRNS')
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Simplify the problem as much as possible. For example, you would probably have the same problem if there were only 2 o4 3 tables involved in your query. Try to construct a problem that only has 2 or 3 tables, and post only those tables, and the results you want from them.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using. -
Total count and count based on column value
Primaryid Id Status
1 50 1
2 50 1
3 50 1
4 50 3
5 50 2
6 50 1
7 51 1
8 51 2Im looking for a query which returns total count of rows for id 50 and count of rows with status 1
something like
Id count_total count_total_status1
50 6 4
51 2 1Any suggestion ?SQL> select * from t4;
PID ID STATUS
1 50 1
2 50 1
3 50 1
4 50 3
5 50 2
6 50 1
7 51 1
8 51 2
已选择8行。
SQL> select distinct id,count(id),sum(decode(status,1,1,0)) from t4 group by id;
ID COUNT(ID) SUM(DECODE(STATUS,1,1,0))
51 2 1
50 6 4 -
Hi,
We are using SAP BI 7.0
The requirement is to count the "TOTAL number of EQUIPMENTS" in a plant with reference to "EQUIPMENT TYPE" to report the MTBF against each equipment type.
I have created a CKF, created a formula variable and using the replacement path concept to count the number of equipments in my BEX Query.
The system is calculating the count of equipments which are part of the report.
Example:
Equipment type No. of equipment
Control Valve 06
Pump 12
But my requirement is to count all the equipments from the master data .
Example:
Equipment type No. of equipment
Control Valve 600
Pump 1200
What is the way forward to achieve this.
Please help me.
Thanks & Regards,
RajHi AL and BIll,
Thanks for the help. I tried the soultion proposed by you.
It counts the number of equipments which is in the report result.
But what I am looking is the entire count of Equipments from master data and not the count from the report result.
Thanks,
Raj -
SQL statement with LIMIT and total count?
Hello,
I would like to know if it is possible to execute a single SQL statement that will return me a subset of data (for pagination purposes) that not only includes the subset of data for the page but the count of all available data. Can this be done so as to not take up the cpu and time it takes to essentially run two queries? One to get the subset and one to get the count? I think simply doing a subselect is not going to give me what I want in that we actually query twice.
There may be no way to do this other than that, but I wanted to check with the gurus here first. :)
Thanks,
Markselect *
from (
select i.*,
row_number() over(order by i) rn, -- used for
pagination
count(*) over(partition by 1) cnt -- total count
of rows found for this search
from mytable
where < PUT ALL LIMITING (i.e., "search") CONDITIONS
HERE >
where rn between 41 and 50 -- pagination clauseNice one
BUT of course it adds additional row in execution plan and takes additional time and CPU :)
I assume that it directly depends of course on returned result set and some other factors like available sort space but a simple test case on a table big which actually is 1.6 M rows like dba_source got following results:
here is the first one returning also count(*)
SQL> select *
2 from (
3 select i.*,
4 row_number() over(order by owner, name, type) rn
5 , -- used for pagination
6 count(*) over(partition by 1) cnt -- total count of rows found for this search
7 from big i
8 where owner like 'S%' and name like '%A%'
9 )
10 where rn between 41 and 45
11 /
OWNER NAME TYPE
LINE
TEXT
RN CNT
SYS ANYDATA TYPE
13
STATIC FUNCTION ConvertVarchar(c IN VARCHAR) return AnyData,
41 999744
SYS ANYDATA TYPE
11
STATIC FUNCTION ConvertDate(dat IN DATE) return AnyData,
42 999744
SYS ANYDATA TYPE
9
43 999744
SYS ANYDATA TYPE
7
They serve as explicit CAST functions from any type in the Oracle ORDBMS
44 999744
SYS ANYDATA TYPE
6
enable construction of the AnyData in its entirity with a single call.
45 999744
Elapsed: 00:00:41.02
SQL> ed
Wrote file afiedt.buf
1 select n.name, m.value from v$statname n, v$mystat m
2 where n.statistic# = m.statistic#
3* and (upper(name) like '%SORT%' or upper(name) like '%TEMP%')
SQL> /
NAME VALUE
physical reads direct temporary tablespace 35446
physical writes direct temporary tablespace 17723
RowCR attempts 0
SMON posted for dropping temp segment 0
sorts (memory) 36
sorts (disk) 1
sorts (rows) 1999596
OTC commit optimization attempts 0
8 rows selected.here is the second one returning only rows:
SQL> ed
Wrote file afiedt.buf
1 select *
2 from (
3 select i.*,
4 row_number() over(order by owner, name, type) rn
5 --, -- used for pagination
6 -- count(*) over(partition by 1) cnt -- total count of rows found for this search
7 from big i
8 where owner like 'S%' and name like '%A%'
9 )
10* where rn between 41 and 45
SQL> /
OWNER NAME TYPE
LINE
TEXT
RN
SYS ANYDATA TYPE
13
STATIC FUNCTION ConvertVarchar(c IN VARCHAR) return AnyData,
41
SYS ANYDATA TYPE
11
STATIC FUNCTION ConvertDate(dat IN DATE) return AnyData,
42
SYS ANYDATA TYPE
9
43
SYS ANYDATA TYPE
7
They serve as explicit CAST functions from any type in the Oracle ORDBMS
44
SYS ANYDATA TYPE
6
enable construction of the AnyData in its entirity with a single call.
45
Elapsed: 00:00:12.09
SQL> select n.name, m.value from v$statname n, v$mystat m
2 where n.statistic# = m.statistic#
3 and (upper(name) like '%SORT%' or upper(name) like '%TEMP%')
4 /
NAME VALUE
physical reads direct temporary tablespace 0
physical writes direct temporary tablespace 0
RowCR attempts 0
SMON posted for dropping temp segment 0
sorts (memory) 10
sorts (disk) 0
sorts (rows) 999812
OTC commit optimization attempts 0
8 rows selected.So execution time 41 sec vs 12 sec
sorts (rows) 1 999 596 vs 999 812
physical reads/writes direct temporary tablespace 35446/17723 vs 0/0
I assume that for a small overall returned row count it probably is OK, but for less restrictive search it can be quite deadly as before with two queries.
Gints Plivna
http://www.gplivna.eu -
0 "Transactions Committed Total Count"
Hi,
I have a stateless session bean which has <transaction-type>Container</transaction-type>.
and <stateless-bean-methods-are-idempotent>true</stateless-bean-methods-are-idempotent>.
But when I monitoring it, there is always 0 in "Transactions Committed Total Count"
column, also 0 for "Rolled Back" and "Timed out" column. I knew the bean was used
a lot, but why it has 0 transactions showed?
ThanksHello Jen,
Mostly, WebLogic will default entity beans to the "Supports" transaction attribute.
This means that if the method is invoked within a transaction context, the transaction
context will be propogated to the underlying EJB with the Supports transaction
attribute. However, if the Supports EJB was not invoked within a transaction context,
it will execute and perform without problems. If you want to explicity initiate
transactions for each method call that you specify, then it's best to use a transaction
attribute of Required, RequiresNew, or Mandatory. Hope this helps.
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Jen" <[email protected]> wrote:
>
If not define, is there any default behavior?
The bean itself just do database lookup, doesn't need to be in transaction,
but
I don't know how to time out it, so thought using transaction to prevent
long
time query.
"Ryan LeCompte" <[email protected]> wrote:
Hello Jen,
Try specifying the actual transaction attributes in your ejb-jar.xml
file. If
you need examples, refer to the following link:
http://www.vipan.com/htdocs/ejb-jar.xml.html
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Jen" <[email protected]> wrote:
I didn't specify any transaction attribute, leaving it blank,
<assembly-descriptor></assembly-descriptor>
Thanks
"Ryan LeCompte" <[email protected]> wrote:
Hello Jen,
What transaction attribute are you using? (eg: Required, Mandatory,etc.).
The transaction attribute that you choose for your EJBs will determine
if transactions
are actually initiated and propogated across calls to other EJBs.
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Jen" <[email protected]> wrote:
Hi,
I have a stateless session bean which has <transaction-type>Container</transaction-type>.
and <stateless-bean-methods-are-idempotent>true</stateless-bean-methods-are-idempotent>.
But when I monitoring it, there is always 0 in "Transactions Committed
Total Count"
column, also 0 for "Rolled Back" and "Timed out" column. I knew thebean
was used
a lot, but why it has 0 transactions showed?
Thanks -
Hi,
I want to get the total count of open invoices and paid invoices and total amount for a give list of vendors between a date range. Could anyone tell me what tables I should use to get the data?
ThanksHi,
two vendor tables BSIK (for open items) and BSAK (for vendor cleared items) will serve the purpose for using them in you program.
regards,
chaitanya -
How to find total count of records in a cursor
Aassume below is the cursor i defined
cursor c1 is select * from emp;
now, i want to find the total count of records in this cursor using an existing function etc., using one line statement.
FYI: c1%rowcount is always giving 0, so i cant rely on this.
Any thoughts, please share.
Thanks in advance.I am just showing this to show how to get the rowcount along with the cursor, if the program has so much gap of between verifying the count(*) and opening the cursor.
Justin actually covered this, he said, oracle has to spend some resources to build this functionality. As it is not most often required, it does not makes much sence to see it as a built-in feature. However, if we must see the rowcount when we open the cursor, here is a way, but it is little bit expensive.
SQL> create table emp_crap as select * from emp where 1 = 2;
Table created.
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from (select rownum rn, e.ename from emp_crap e) order by 1 desc)
6 loop
7 if v_cnt = 0 then
8 v_cnt := rec.rn;
9 end if;
10 end loop;
11 if v_cnt = 0 then
12 raise zero_rows;
13 end if;
14 exception
15 when zero_rows then
16 dbms_output.put_line('No rows');
17 end;
18 /
No rows
PL/SQL procedure successfully completed.
-- Now, let us use the table, which has the data
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from
6 (select rownum rn, e.ename from emp e)
7 order by 1 desc)
8 loop
9 if v_cnt = 0 then
10 v_cnt := rec.rn;
11 dbms_output.put_line(v_cnt);
12 end if;
13 end loop;
14 if v_cnt = 0 then
15 raise zero_rows;
16 end if;
17 exception
18 when zero_rows then
19 dbms_output.put_line('No rows');
20 end;
21 /
14
PL/SQL procedure successfully completed.Thx,
Sri -
Total count to be displayed in subtotal ALV(GRID Display)
Hello ,
I want to display total count in subtotal.
720 Mr JORGE 522,06
720 Mr JORGE 566,23
720 Mr JORGE 100,33
720 Mr JORGE 123,33
720 Mr JORGE 332,22
subtotal -> 720 1644.2 Count 5
888 Ms Mariam 100,00
subtotal -> 888 100,00 Count 1
Is this possible? Plz dont post same answers how to display subtotal. I am able to display subtotal , only issue is to display with count.
Edited by: Vimalnair on Aug 19, 2009 9:37 AMHi,
You cannot have subtotal for particular number of rows of ALV,
but if you want to get the total number of rows of the ALV data display
you can describe your final internal table from which the data is
getting displayed in ALV output and get it displayed in the header
or footer area of the ALV output.
For Eg:
DATA V_LINES TYPE I.
DESCRIBE TABLE IT_FINAL LINES V_LINES.
DATA: it_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'COMM'
i_callback_top_of_page = 'TOP' "This top will call the subroutine namely TOP
FORM top.
REFRESH it_header.
wa_header-typ = 'S'.
wa_header-key = text-001.
wa_header-info = sy-repid.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = text-002.
wa_header-info = sy-uname.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = text-003.
wa_header-info = V_LINES. "This will print the total number of lines in the header
APPEND wa_header TO it_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
ENDFORM. "TOP
Hope it helps
Regards
Mansi -
Introduction
We need to loop through all the flat files that have the same structure in a folder and import all the data to a single SQL Server table. How can we obtain the total count of the rows inserted to the destination SQL Server table?
Solution
We can use Execute SQL Task or Script Task to aggregate the row count increment for each iteration of the Foreach Loop Container. The following steps are the preparations before we add the Execute SQL Task or Script Task:
Create a String type variable FilePath, two Int32 type variables InsertRowCnt and TotalRowCnt.
Drag a Foreach Loop Container to the Control Flow design surface, set the Enumerator to “Foreach File Enumerator”, specify the source folder and the files extension, and set the “Retrieve file name” option to “Fully qualified”.
On the “Variable Mappings” tab of the container, map the variable FilePath to the collection value.
Drag a Data Flow Task to the container, in the Data Flow Task, add a Flat File Source, a Row Count Transformation, and an OLE DB Destination, and join them. Create a Flat File Connection Manager to connect to one of the flat files, and then configure the
Flat File Source as well as the OLE DB Destination adapter. Set the variable for the Row Count Transformation to “User::InsertRowCnt”.
Open the Property Expressions Editor for the Flat File Connection Manager, and set the expression of “ConnectionString” property to
“@[User::FilePath]”.
(I) Execute SQL Task Method:
In the Control Flow, drag an Execute SQL Task under the Data Flow Task and join them.
Create one or using any one existing OLE DB Connection Manager for the Execute SQL Task, set the “ResultSet” option to “Single row”, and then set the “SQLStatement” property to:
DECLARE @InsertRowCnt INT,
@TotalRowCnt INT
SET @InsertRowCnt=?
SET @TotalRowCnt=?
SET @TotalRowCnt=@InsertRowCnt+@TotalRowCnt
SELECT TotalRowCnt=@TotalRowCnt
On to parameter 1.
On the “Result Set” tab of the Execute SQL Task, map result 0 to variable “User::TotalRowCnt”.
(II) Script Task Method:
In the Control Flow, drag a Script Task under the Data Flow Task and join them.
In the Script Task, select variable InsertRowCnt for “ReadOnlyVariables” option, and select variable TotalRowCnt for “ReadWriteVariables”.
Edit the Main method as follows (C#):
public void Main()
// TODO: Add your code here
int InsertRowCnt = Convert.ToInt32(Dts.Variables["User::InsertRowCnt"].Value.ToString()
int TotalRowCnt = Convert.ToInt32(Dts.Variables["User::TotalRowCnt"].Value.ToString());
TotalRowCnt = TotalRowCnt + InsertRowCnt;
Dts.Variables["User::InsertRowCnt"].Value = TotalRowCnt;
Dts.TaskResult = (int)ScriptResults.Success;
Or (VB)
Public Sub Main()
' Add your code here
Dim InsertRowCnt As Integer =
Convert.ToInt32(Dts.Variables("User::InsertRowCnt").Value.ToString())
Dim TotalRowCnt As Integer =
Convert.ToInt32(Dts.Variables("User::TotalRowCnt").Value.ToString())
TotalRowCnt = TotalRowCnt + InsertRowCnt
Dts.Variables("User::TotalRowCnt").Value = TotalRowCnt
Dts.TaskResult = ScriptResults.Success
End Sub
Applies to
Microsoft SQL Server 2005
Microsoft SQL Server 2008
Microsoft SQL Server 2008 R2
Microsoft SQL Server 2012
Microsoft SQL Server 2014
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Hi ITBobbyP,
If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
If in this scenario, please refer to the following tips:
The Foreach Loop container should be configured as shown below:
Enumerator: Foreach ADO.NET Schema Rowset Enumerator
Connection String: The OLE DB Connection String for the excel file.
Schema: Tables.
In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
The connection string for Excel Connection Manager is the original one, we needn’t make any change.
Change Table Name or View name to the variable Sheet_Name.
If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Pagination Displaying Count of Total Records available and Current Page
Hi,
I need to implement paging in one of our pages.
The problem is we need to display the count of total number of records the search has resulted and the search results that fall into the current page.
For e.g. If the search resulted in 100 records total and we are in page 5 (with 10 records per page), I need to display the count 100 on the top and records 51-50 in the page.
How to get the count of fetched results without running a second SELECT COUNT(1) FROM ... clause.
Is there a way to do this in a optimized way?
ThanksHow to get the count of fetched results without running a second SELECT COUNT(1) FROM ... clause.
SQL> select cnt "Total", rn "Line", empno, ename, job
from (select count (*) over () cnt, row_number () over (order by empno) rn,
empno, ename, job
from emp)
where rn between 4 and 6
Total Line EMPNO ENAME JOB
14 4 7566 JONES MANAGER
14 5 7654 MARTIN SALESMAN
14 6 7698 BLAKE MANAGER -
I want to display total count on the top of a Column in business graphics
Hi All ,
How can I display total count of the column say for example no. of employees in a series of column chart type in business graphics.
Any type of help would be much appreciated.
Thanks
UdayHi Vishweshwara,
following is the code i wrote. please check the correctness of the code.
int seriescount = 0;
for(int i=0;i<nodesize;i++){
IGraphDataElement catele = gdNode.createGraphDataElement();
switch(i){
case 0:
if(wdContext.currentContextElement().getQ().equals("Q1")){
catele.setCategory("Q1");
catele.setKRA_Series1(Q1_KRA);
catele.setApp_Pln_Series2(Q1_AP);
catele.setRev_App_Series3(Q1_RA);
catele.setEnd_Rev_Series4(Q1_ERP);
catele.setApp_Procss_Series5(Q1_AIP);
catele.setApp_overall_Series6(Q1_AOP);
seriescount = seriescount+1; break;}
break;
case 1:
if(wdContext.currentContextElement().getQ().equals("Q2")){
catele.setCategory("Q2");
catele.setKRA_Series1(Q2_KRA);
catele.setApp_Pln_Series2(Q2_AP);
catele.setRev_App_Series3(Q2_RA);
catele.setEnd_Rev_Series4(Q2_ERP);
catele.setApp_Procss_Series5(Q2_AIP);
catele.setApp_overall_Series6(Q2_AOP);
seriescount = seriescount+1; break; }
break;
case 2:
if(wdContext.currentContextElement().getQ().equals("Q3")){
catele.setCategory("Q3");
catele.setKRA_Series1(Q3_KRA);
catele.setApp_Pln_Series2(Q3_AP);
catele.setRev_App_Series3(Q3_RA);
catele.setEnd_Rev_Series4(Q3_ERP);
catele.setApp_Procss_Series5(Q3_AIP);
catele.setApp_overall_Series6(Q3_AOP);
seriescount = seriescount+1; break;}
break;
case 3:
if(wdContext.currentContextElement().getQ().equals("Q4")){
catele.setCategory("Q4");
catele.setKRA_Series1(Q4_KRA);
catele.setApp_Pln_Series2(Q4_AP);
catele.setRev_App_Series3(Q4_RA);
catele.setEnd_Rev_Series4(Q4_ERP);
catele.setApp_Procss_Series5(Q4_AIP);
catele.setApp_overall_Series6(Q4_AOP);
seriescount = seriescount+1; break;}
break;
case 4: if(wdContext.currentContextElement().getQ().equals("All")){
wdContext.nodeGraphData().invalidate();
wdContext.currentContextElement().setGraphVisibility(WDVisibility.NONE);
wdThis.onActiondropdownaction(wdEvent);
}default:
wdContext.nodeGraphData().addElement(catele);
Thanks
Uday -
How to count the total lines of the file (including the file header)
Hi all,
I am working with Idoc to file scenario(FCC).
I need to map one of the field with a recound count ie.., count of the total lines of the file (including the file header).
Eg:Record Count-- mapping area:Total number of records in the file including file header The total line of the file (including the file header).
Can i get a help on this.
Thanks and Regards,
ManojHi !
If there is a tag of your IDOC that occurs the same quantity of times as file lines you have to create in your target file, you could make a Java user defined function in graphical mapping that "caches the entire queue" (use the corresponding option button), that receives as input that field of the IDOC, and returns the "lenght" (.length property value) of that input parameter (it is an array) as output..that should be the file line quantity..you may also add 1 to that count, for the header.
Hope it helps.
Regards,
Matias.
Maybe you are looking for
-
How do I add a phone number while in a call to send as a dtmf?
Hi, I use a calling service that I can dial into to place calls and make the call look like it's coming from my office. I consider myself an advanced user and have set up my phone to dial into the service and automatically enter my login codes as DTM
-
Can PMAC be run Daily and Can we see the Batch Update Cost Daily?
Dear Gurus, My Client wants to see Daily Updated Cost each end of day Through PMAC. Is it possible to run daily and Can we also see the COGS too. Now we have a Requirement here : My Clinet During the Production Process uses : Boiler Fuel, Chlorine, E
-
Hi, Below is the scenario.... I created a Standard Purchase Order and an Inbound delivery... When I trying to create Transfer orders for that Inbound delivery through LT03, and save it....I am getting error message saying "Mixed Storage is not allowe
-
Folder with question mark - Previous posts not resolving my issue
Good evening everyone I have a Macbook Pro, which I bought in 2009. I have never had any problems, and I have been regularly deleting rubbish to keep the memory ok (Pictures, downloads, old text docs etc) I went online yesterday afternoon, to check o
-
Intermittent Blank Screen - Multi-Tab Corporate Dashboard
Hi All, We are a facing an intermittent blank screen issue with our corporate dashboard. Details are as follows: - Environment: BO XI 3.1 SP2 FP2 (Two servers on production) Xcelsius 2008 Live Office QaaWS Issue: Sometimes we only see a blank screen