[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: Don Mellen <donm@ontko.com>
- Date: Wed, 7 Sep 2005 13:38:53 -0500 (EST)
- Delivery-date: Wed, 07 Sep 2005 13:39:30 -0500
- In-reply-to: <s31ef4ff.089@rainbow-media.com>
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
Jessie,
In version 6.2 you have to over-allocate, or have 2 sqr programs.
The "dynamic" way that you mention is using 2 sqr programs.
The first sqr program determines the number of array elements needed and
calls the second sqr program with the "CALL SYSTEM USING" command and
passes the number as a parameter.
The second sqr (the main code) uses an "ASK" command to set a
compile-time substitution variable, which is used as the value for "SIZE="
in the "CREATE-ARRAY" command.
This method means that the sqr programs (at least the second one) must
remain uncompiled. A compiled SQT will set the "ASK" value when it's
compiled.
In version 8.0 and above (non-peoplesoft) there was an "EXTENT=" option
added to the "CREATE-ARRAY" command to allow arrays to grow as needed.
HTH,
Don
On Wed, 7 Sep 2005, Jessie Dickenson wrote:
> Thank you Bob for your prompt response.
>
> I am actually over-allocating the storage; but figured there maybe a
> cleaner way to deal with the array size. While searching the archives of
> this forum, I found a solution that it is possible to allocate the size
> dynamically by using substitution variables.
>
> While I do have a solution by over-allocating for the agenct count at
> comple time, I would still like to know if this dynamic allocation
> really works in 6.2.
>
> Thanks again.
> Jessie
>
> >>> bstone@fastenal.com 09/07/05 1:59 PM >>>
> 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
>
>
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
>
-----------------------------------------------------------------------
Donald Mellen | Ray Ontko & Co. - Richmond, IN - http://www.ontko.com/
donm@ontko.com | "In the beginning, there was nothing, which exploded"
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users