Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
COUNTER PROBLEM
 Login/Join
 
Member
posted
Hiho,
this time i want to make a loop.
i have the following code:

DEFINE FILE Testtable
-REPEAT LOOP 2 TIMES
...
-LOOP
END

this work fine.
Now
In my Testtable ive got a col with an interger and i want to runn that loop so many times the column value

i make :
DEFINE FILE Testtable
counter/i9 = counter_col;
-REPEAT LOOP counter times
...
-LOOP
END

This will ead in an FOC303 CONTROL LINE NOT RECOGNIZED IN FOCEXEC ERROR.

also
-REPEAT LOOP counter_coll TIMES
and
-REPEAT LOOP Testtable.counter_col

leads into this error.

any suggestions?

thnx


Webfocus 8.0.0.2
Windows 7 Enterprise
 
Posts: 12 | Registered: July 11, 2013Report This Post
Virtuoso
posted Hide Post
You're using two different languages, namely FOCUS and Dialog Manager, and they can't communicate values to each other directly.

To do what you want, you'll have to write the table results that contain the counter to an ALPHA file and -READ or -READFILE that file into a dialog manager variable.

TABLE FILE yadayada
SUM COUNTER
ON TABLE HOLD AS foo FORMAT ALPHA
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN

-DEFAULTH &COUNTER = 0;
-READFILE foo

-REPEAT LOOPx &COUNTER TIMES
-* Do stuff
-LOOPx


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Virtuoso
posted Hide Post
This is mixing Dialogue Manager control with a DEFINE variable. Dialogue Manager is interpreted at run time prior to the DEFINE and TABLE code.

If you can explain what you are trying to achieve, a better solution may be found here.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
HMM that dosnt work:

TABLE FILE RELEASE_INFO_PERM_ALL_DEFECTS_FINAL
SUM DURATION_M
ON TABLE HOLD AS STEP1 FORMAT ALPHA
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN

DEFINE FILE RELEASE_INFO_PERM_ALL_DEFECTS_FINAL
-DEFAULT &DURATION_M =0;
-READ STEP1
-REPEAT THISLOOP &DURATION_M TIMES
TESTCL&DAY/I9 = 1;

-SET &DAY=&DAY+1;
-THISLOOP
END

have i made an mistake?
why do you sum the counter?
i need the value for every row in the original table to run the loop different times.

greetings


Webfocus 8.0.0.2
Windows 7 Enterprise
 
Posts: 12 | Registered: July 11, 2013Report This Post
Member
posted Hide Post
@alan:
i will make this:

DEFINE FILE RELEASE_INFO_PERM_ALL_DEFECTS_FINAL


-*-SET &VAR = HDIFF(UPDATED_DATE,CREATED_DATE,'MONTH','I9');
-REPEAT THISLOOP 2 TIMES
TESTCL&DAY/I9 = 1;
-SET &DAY=&DAY+1;
-THISLOOP
END

TABLE FILE RELEASE_INFO_PERM_ALL_DEFECTS_FINAL
-SET &DAY=0;
PRINT
PKEY
DURATION_M
-REPEAT PRINTLOOP 2 TIMES

TESTCL&DAY
-SET &DAY=&DAY+1;
-PRINTLOOP

WHERE PKEY EQ 'CORE-5626'
ON TABLE HOLD AS 1STGRAPH FORMAT XFOCUS
END

for the moment i have hardcoded the loop to run 2 times.

i will calculate virtual fields for a duration of month ( i have a start date and a end date and mark now all month between)
now i want to remove the hardcoded "2" und replace it with the value of the field duration_m (integer) of table RELEASE_INFO_PERM_ALL_DEFECTS_FINAL
to run the loop.


Webfocus 8.0.0.2
Windows 7 Enterprise
 
Posts: 12 | Registered: July 11, 2013Report This Post
Virtuoso
posted Hide Post
Ah, so that's what you're trying to do! Your approach won't work though; you need to generate records, not columns/fields.

What you're after is a rather advanced topic, I'm afraid.

One way to do this is to map your table onto some kind of calendar table (with a record for every date in your range).
A table like that can be generated using the McGyver technique (see the tech library for articles on that topic). Alternatively, you could generate a table in your database, which is probably easier to do.

Once you have that table, you can use MATCH FILE to merge your table to the calendar table, matching on the dates, after which you can pass the result over into a new file using COMPUTE and LAST to fill in the blanks (the records with dates between your start and end dates).

That already sounds complicated enough, but if your data has overlapping date ranges you'll need to find a combination of another key with your dates to make them unique and generate the calendar with those keys instead of just the date.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Member
posted Hide Post
i have written some code to transform the added coloumns in rows for later use.
ok maybe i must try a different way,

is there a possibility to store a minimum valu in a variable?

i think something like that:

a) calculate the minimum of a date of alle rows (i think BY LOWEST 1 will work)
but how can i store this in a variable?

something like &lowdate = result from a)
?

with this i can compute constant looping

greetings


Webfocus 8.0.0.2
Windows 7 Enterprise
 
Posts: 12 | Registered: July 11, 2013Report This Post
Virtuoso
posted Hide Post
That's what -READ and -READFILE are for.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Expert
posted Hide Post
quote:
TABLE FILE RELEASE_INFO_PERM_ALL_DEFECTS_FINAL
SUM DURATION_M
ON TABLE HOLD AS STEP1 FORMAT ALPHA
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN

Is there only 1 value in the field DURACTION_M ?
BEfore you go further, don't HOLD this little extract file...
Let it come to the screen, so you know the number you're getting is correct.
Then how big is that number? what's its format? is it 8 positions, say? eg is its format /I8 ?
you need to know that so you can -READ its value back into an & var. Lets assume its 8...
Forget the HOLDLIST bit, it doesn't matter here.
-DEFAULTH &myduration = 0 ;
TABLE FILE whatever
SUM DURATION_M
ON TABLE HOLD AS STEP1 FORMAT ALPHA
END
-RUN
-READ STEP1 &myduration.A8
-TYPE myduration is &myduration
-* now put a -EXIT in here so you can be sure that the value in &myduration is what you want.
-* if it is, now go do your report but with your loop

now, on your min value question, sure
-DEFAULTH &myduration = 1 ; (or whatever you want your min to be)
then before you do your -READ, check to see if you got any lines out at all.
...
ON TABLE HOLD AS STEP1 FORMAT ALPHA
END
-RUN
-IF &LINES EQ 0 GOTO somelabel ;
-READ STEP1 &myduration.A8
-somelabel
-TYPE myduration is &myduration
and carry on...




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders