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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Trying to get some -IF/THEN/ELSE IF/THEN logic to work...

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Trying to get some -IF/THEN/ELSE IF/THEN logic to work...
 Login/Join
 
Virtuoso
posted
Hey all,

So, I've had these widgets I've built that are housed within a portal of ours. Upon portal launch, if the value of &HIDDEN from the html filters we have in the portal is 'N' (the default), then it skips loading this content and jumps down to the bottom and loads a simple html page that says "Please wait..." until the filters finish loading, after which the value of &HIDDEN is 'Y' (passed) allowing the content to populate.

I've been wanting to add the additional check to see if the &DSACCTNO value (from the filters) passed is '_FOC_NULL' or a store number was indeed passed to the content. If &DSACCTNO is '_FOC_NULL' then it should go to the bottom and launch a different html page that simply states for the user to "Select a store.". This part now works, but the "Please wait..." html doesn't load anymore.

I thought I was doing the logic right, but when I run it, the "Please wait..." html page never loads initially, the autoprompt facility does up till the filters finally load. Then when the filters are loaded, the "Select a Store." html loads (which I want). I want the "Please wait..." html page to be loaded up till the filters are loaded, and then the "Select a store." html page to then load until the user selects a store from the filter drop down.

Does anyone here see something wrong with my logic?

My code:

-* Test for saving multiple records of field values to DM variables to then display within custom HTML.
-*
-* This procedure takes a request for the top 5 performers in a given metric (for range of time specified)
-* and reads each record's values into their own Dialog Manager &variables
-* to be then used in custom HTML, CSS, and Js below.

-SET &ECHO = ALL;

-*-DEFAULTH &HIDDEN = 'Y';
-DEFAULTH &HIDDEN = 'N';

-IF &HIDDEN EQ 'N' THEN GOTO Wait ELSE
-IF ((&HIDDEN EQ 'Y') AND (&DSACCTNO EQ _FOC_NULL)) THEN GOTO SelectStore;

-DEFAULTH &CNAME1 = 1;
-DEFAULTH &CNAME2 = 1;
-DEFAULTH &CNAME3 = 1;
-DEFAULTH &CNAME4 = 1;
-DEFAULTH &CNAME5 = 1;

-DEFAULTH &STRNAME1 = 1;
-DEFAULTH &STRNAME2 = 1;
-DEFAULTH &STRNAME3 = 1;
-DEFAULTH &STRNAME4 = 1;
-DEFAULTH &STRNAME5 = 1;

-DEFAULTH &SRPDGROSSSALES1 = 1;
-DEFAULTH &SRPDGROSSSALES2 = 1;
-DEFAULTH &SRPDGROSSSALES3 = 1;
-DEFAULTH &SRPDGROSSSALES4 = 1;
-DEFAULTH &SRPDGROSSSALES5 = 1;

-DEFAULTH &DSACCTNO = '12312';
-DEFAULTH &WEEKENDING = '20150725';

-SET &THREEWKSPREV = AYMD(&WEEKENDING.QUOTEDSTRING, -21, 'YYMD');

DEFINE FILE SRPROD
WKEND_MDYY/MDYY=DATECVT(SRPROD.DIMDATE.WEEKENDING, 'YYMD', 'MDYY');
INT_CASHIERNO/I10 = EDIT(SRPROD.SRPROD.SRPDCASHIERNO);
INT_STORENO/I5 = IF INT_CASHIERNO GT 9999 THEN INT_CASHIERNO;
STORENO/A5 = EDIT(INT_STORENO);
END
-RUN
TABLE FILE SRPROD
SUM
     SRPROD.DIMSTORE.DSNAME/A50
	 SRPROD.SRPROD.SRPDGROSSSALES
BY TOTAL HIGHEST 5 SRPROD.SRPROD.SRPDGROSSSALES NOPRINT
BY SRPROD.SRPROD.SRPDCASHIERNAME/A35
WHERE ( SRPROD.DIMSTORE.DSACCTNO EQ &DSACCTNO.(FIND SRPROD.DIMSTORE.DSACCTNO IN SRPROD).DSACCTNO:. );
WHERE ( SRPROD.DIMDATE.WEEKENDING GE '&THREEWKSPREV');
WHERE ( SRPROD.DIMDATE.WEEKENDING LE '&WEEKENDING');
WHERE SRPDCASHIERNO NE STORENO;
WHERE SRPDCASHIERNO NE '800';
WHERE SRPDCASHIERNO NE '997';
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE FORMAT ALPHA
END
-RUN

-SET &I = 0;
-LOOP
-SET &I = &I + 1;
-IF &I GT 5 GOTO OUT;
-READ SAVE &SRPDCASHIERNAME.&I.A35. &SNAME.&I.A50. &SRPDGROSSSALES.&I.I10.
-SET &CNAME.&I = TRUNCATE(&SRPDCASHIERNAME.&I);
-SET &STRNAME.&I = TRUNCATE(&SNAME.&I);
-TYPE &CNAME.&I &STRNAME.&I &SRPDGROSSSALES.&I
-GOTO LOOP
-OUT

-SET &HEAD = 'Top 5 at &STRNAME1.EVAL<br>for the last 4 weeks';
-SET &CASHIER_LBL = 'Top Cashiers';
-SET &METRIC_LBL = 'Top Sales';
-SET &CLASS = 'blue-alert';

-HTMLFORM BEGIN
<html>
<head>
<link rel='stylesheet' id='options_typography_Montserrat-regular-css'  href='https://fonts.googleapis.com/css?family=Montserrat:regular' type='text/css' media='all' />
<link rel='stylesheet' id='options_typography_Montserrat-400-css'  href='https://fonts.googleapis.com/css?family=Montserrat:400' type='text/css' media='all' />
<link rel="stylesheet" type="text/css" href="/ibi_apps/jquery/css/smoothness/jquery-ui.custom.min.css">
<script type="text/javascript" src="/ibi_apps/jquery/js/jquery.min.js"></script>
<script type="text/javascript" src="/ibi_apps/jquery/js/jquery-ui.custom.min.js"></script>
<link rel='stylesheet' href='/ibi_apps/run.bip?BIP_REQUEST_TYPE=BIP_RUN&|BIP_folder=IBFS%253A%252FWFC%252FRepository%252F...%252F...%252F...%252F&|BIP_item=x.css' type='text/css' media='all' />
<script>
function formatNum(num) {
	var suffixK = "K";
	var suffixM = "M";
	if ((num > 999 && num < 1000000)||(num < -999 && num > -1000000)) {
		num = num / 1000;
		num = num.toFixed(1).concat(suffixK);
		return "$" + num;
	}
	else if ((num > 999999)||(num < -999999)){
		num = num / 1000000;
		num = num.toFixed(1).concat(suffixM);
		return "$" + num;
	}
	else {
		return "$" + num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
	}
}

function loadNumbers() {
  $('#name1').html('!IBI.AMP.CNAME1;');
  $('#name2').html('!IBI.AMP.CNAME2;');
  $('#name3').html('!IBI.AMP.CNAME3;');
  $('#name4').html('!IBI.AMP.CNAME4;');
  $('#name5').html('!IBI.AMP.CNAME5;');
  $('#num1').html(formatNum('!IBI.AMP.SRPDGROSSSALES1;'));
  $('#num2').html(formatNum('!IBI.AMP.SRPDGROSSSALES2;'));
  $('#num3').html(formatNum('!IBI.AMP.SRPDGROSSSALES3;'));
  $('#num4').html(formatNum('!IBI.AMP.SRPDGROSSSALES4;'));
  $('#num5').html(formatNum('!IBI.AMP.SRPDGROSSSALES5;'));
-*  condFrmt();
}
</script>
</head>
<body onLoad="loadNumbers()">
<div class="!IBI.AMP.CLASS;" style="border-radius: 0px; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; height: 100%">
<div style="width:100%">
<span style="font-size:.75em">!IBI.AMP.HEAD;</span><br><br>
</div>
<div style="width:50%;float:left;padding:0;margin:0">
<span style="font-size:.75em">!IBI.AMP.CASHIER_LBL;</span><br><hr>
<span id="name1" style="font-size:.9em"></span><br>
<span id="name2" style="font-size:.9em"></span><br>
<span id="name3" style="font-size:.9em"></span><br>
<span id="name4" style="font-size:.9em"></span><br>
<span id="name5" style="font-size:.9em"></span>
</div>
<div style="width:50%;float:left;padding:0;margin:0">
<span style="font-size:.75em">!IBI.AMP.METRIC_LBL;</span><br><hr>
<span id="num1" style="font-size:.9em"></span><br>
<span id="num2" style="font-size:.9em"></span><br>
<span id="num3" style="font-size:.9em"></span><br>
<span id="num4" style="font-size:.9em"></span><br>
<span id="num5" style="font-size:.9em"></span>
</div>
</div>
</body>
</html>
-HTMLFORM END

-IF &HIDDEN EQ 'Y' THEN GOTO TheEnd;

-SelectStore

-HTMLFORM IBFS:/WFC/Repository/.../Select_A_Store.htm

-GOTO TheEnd

-Wait

-HTMLFORM IBFS:/WFC/Repository/.../PlzWaitForFilters.htm

-TheEnd

This message has been edited. Last edited by: CoolGuy,


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
 
Posts: 1113 | Location: USA | Registered: January 27, 2015Report This Post
Expert
posted Hide Post
Have you tried commenting,out the HTMLFORMS to see whats happening ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Master
posted Hide Post
Is there a parameter in Select_A_Store.htm that has no DEFAULTH?

That would trigger the autoprompt even before your IF/THEN logic begins processing.

and...
I never use
-IF &HIDDEN EQ 'N' THEN GOTO Wait ELSE


I do
-IF &HIDDEN EQ 'N' THEN GOTO Wait ELSE CONTINUE

or maybe, rather not:
-IF &HIDDEN EQ 'N' THEN GOTO Wait


Good luck,dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Guru
posted Hide Post
quote:
Wait

When I use Dialogue Manager if/else I do it like this;

-IF ..... THEN GOTO ....
-ELSE IF ..... THEN GOTO....
-ELSE ..............

I noticed your ELSE IF is not where I would put it. Maybe that is messing with the logic.


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
 
Posts: 272 | Location: Kalamazoo, Michigan | Registered: September 30, 2010Report This Post
Expert
posted Hide Post
quote:
DSACCTNO EQ _FOC_NULL

there are safer ways to check for a value in a previously unspecified &var.
Lets say your &DSACCTNO is 7 characters long,
then &DSACCTNO.LENGTH should eq 7
If the variable hasn't even been set by a default, then the ONLY way to test it carefully is
-GOTO :chk.&DSACCTNO.EXIST ;
-:ckk.1
-IF &DSACCTNO.LENGTH EQ 7 THEN do something
- go somewhere, or goto :chk.end
-:chk.0
- do somethine else if it doesn't exist, maybe default it
- go somewhere
-:chk.end

IF you say -IF &DSACCTNO.EXIST EQ 1 THEN ...
you have actually created the variable, for the duration of your agent session, so that any future tests or drills will be screwed up.

testing for 'FOC_NONE's and 'FOC_NULL's just asks for headaches.




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
Virtuoso
posted Hide Post
Thanks everyone for your help and insights. I finally got it to work. The &DSACCTNO variable doesn't exist until after it's either passed to the .fex or it gets defaulted after the -IF/ELSEs. For some reason, after adding -DEFAULTH &DSACCTNO = _FOC_NULL; up top it began to work like it should.

My newly added/edited code:

-DEFAULTH &DSACCTNO = _FOC_NULL;
-*-DEFAULTH &HIDDEN = 'Y';
-DEFAULTH &HIDDEN = 'N';

-IF &HIDDEN EQ 'N' THEN GOTO Wait;

-IF (&HIDDEN EQ 'Y') AND (&DSACCTNO EQ _FOC_NULL) THEN GOTO SelectStore ELSE GOTO Next;


It's working now. Thanks everyone! Appreciate the insights Susannah, MAdams1, Dave, and Waz!


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
 
Posts: 1113 | Location: USA | Registered: January 27, 2015Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Trying to get some -IF/THEN/ELSE IF/THEN logic to work...

Copyright © 1996-2020 Information Builders