[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] Dynamic Array Size - Version 6.2
- Subject: RE: [sqr-users] Dynamic Array Size - Version 6.2
- From: "Bob Stone" <bstone@fastenal.com>
- Date: Wed, 7 Sep 2005 12:59:24 -0500
- Delivery-date: Wed, 07 Sep 2005 13:00:33 -0500
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
- Thread-index: AcWzzgUZeyXma+SqSEqGXg6xgsLcMQABY/uA
- Thread-topic: [sqr-users] Dynamic Array Size - Version 6.2
did you try assigning the variable a value? Right now, you are not.
Create-Array needs a value at compile time, and AgentCount is set at runtime.
So as it compiles it see 'create array of size null -- ERROR'.
If you don't know how many rows you have, you must over-allocate and specify an
upper bound. If you think you'll have between 60-80 agents usually, maybe set
the array size to 100. 2 months down the road you end up with more agents,
change the array size to 500. The difference to your machine between an array
of 100 and 500 and 5000 is hardly noticable for an SQR.
Go ahead and over-allocate, and if you need to know the number of agents (so
you can cycle through them in the array, or some other reason besides creating
the array of that size) you can either count as you're inserting, or do what
you do with #agent_count. Within the program, using while loops and
#agent_count, you can basically pretend that the array is only as big as
#agent_count...even though more space was allocated at compile time.
-----Original Message-----
From: sqr-users-bounces+bstone=fastenal.com@sqrug.org
[mailto:sqr-users-bounces+bstone=fastenal.com@sqrug.org]On Behalf Of
Jessie Dickenson
Sent: Wednesday, September 07, 2005 11:59 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] Dynamic Array Size - Version 6.2
I need help with dynamic array sizing.
Here is my situation:
I need to create an array & assign the size to a number based on the total
count of agents in a given geographic area.
So, I do the following:
1. I determine the number of agents & assign that count to a variable, #Count.
2, Then, I use this variable in the #Define command to assign this value to a
substitution variable AgentCount.
3. Then, I use this substitution variable, AgentCount for the size parameter
within a Create-Array command.
I get the following SQR error: (SQR 3526) Missing or incorrect SIZE= in
CREATE-ARRAY.
While debugging this, I find the correct value assigned to the substitution
variable, AgentCount. However the Create-Array fails.
I cannot get the agent count within the setup portion, since the count is
returned by a PL/SQL procedure.
Can somebody let me know if I am doing something incorrectly.
Thanks in advance.
Jessie
BEGIN-PROCEDURE Get_Agent_Count
BEGIN-SELECT ON-ERROR=SQR_ERROR((1,'Get_Agent_Count')
COUNT (DISTINCT MY_TBL.AgentLENGTH) &Count
Let #Agent_Count = &Count
FROM
MY_SCHEMA.MY_TBL
WHERE
MY_TBL.RPT_RUN_HDR_ID = #rpt_run_hdr_id
END-SELECT
#Define AgentCount #Agent_Count
Create-Array Name=Arr_Totals size={AgentCount}
END-PROCEDURE Get_Agent_Count
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users