April 01, 2008, 05:20 AM
Tony AStrange effect from Functions
Folks,
I have a current development where I need to perform a couple of repetative data manipulations. I decided to use functions for this as it could be useful across several reports.
The problem arises when I use two functions and the results I am getting are quite strange. If I use one or three functions then the results appear as expected, so it would appear that it is to do with just two functions.
Has anyone else experienced this?
T
April 01, 2008, 08:15 AM
GamPTony,
Coukd you give a code-example for this?
With input and expected output?
That would make it easier to try and understand your problem...
April 01, 2008, 08:38 AM
Tony AGamP,
A bit late for this now of course, but here is a mock up -
APP PREPENDPATH IBISAMP
DEFINE FUNCTION MERGE_IT(X/A10, Y/A16, Z/A24)
MERGE_IT/A10 = EDIT(X,'$$9$$') || EDIT(Z,'$$$$$$9$') || EDIT(Y,'$$$$$9$')
|| EDIT(Z,'$$$$$$$9$$$$$$9$') || (' ' | EDIT(Y,'$$9$$$9$$9')) || EDIT(Y,'$9$');
END
DEFINE FUNCTION CHOOS_IT(X/A10, Y/A16, Z/A24)
CHOOS_IT/A1 = IF ((X EQ 'ITALY') + (Y EQ 'ALFA ROMEO') + (Z CONTAINS 'SPIDER')) EQ 3 THEN 'Y' ELSE 'N';
END
-RUN
TABLE FILE CAR
PRINT COMPUTE CLONE_IT/A10 = MERGE_IT(COUNTRY, CAR, MODEL);
COMPUTE SELECT/A1 = CHOOS_IT(COUNTRY, CAR, MODEL);
COMPUTE DATE/DMtYY = (RCOST * 2.95) + (DCOST * 3.36) + (SEATS * 18) + 1;
COMPUTE TIME/I2 = EDIT(EDIT(HHMMSS('A8'),'99$'));
BY COUNTRY NOPRINT
BY CAR NOPRINT
BY MODEL NOPRINT
ON TABLE HOLD AS TEMP_HLD FORMAT FOCUS
ON TABLE SET HOLDLIST PRINTONLY
END
TABLE FILE TEMP_HLD
PRINT DATE AS '' CLONE_IT AS '' TIME NOPRINT
WHERE SELECT EQ 'Y'
WHERE DATE EQ '&DMYY'
WHERE TIME LE 12
ON TABLE HOLD FORMAT HTMTABLE AS CRASH
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF, SIZE=48, $
TYPE=DATA, CLASS=01_04_f0_01, $
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<html>
<head>
<title>Believe it
</title>
</head>
<style>
.01_04_f0_01 {font-size:48pts; color:#f00104;}
</style>
<body>
<center>
!IBI.FIL.CRASH;
</center>
</body>
</html>
-HTMLFORM END
T
April 01, 2008, 08:59 AM
mgrackinTony,
I can't believe I actually ran that code.
April 01, 2008, 08:59 AM
GamPFor me, it gives me an error message: test value inconsistent with format of field.
But then, I'm on 713 at this moment.
After changing the where date and where time to where total's the request ran fine.
Kinda like the red typing that is presented - Good one!
See you at summit ?
April 01, 2008, 09:07 AM
mgrackinGamP,
I'm on 713 and ran it fine without adjustments.
April 01, 2008, 09:14 AM
Tony AGamP,
Yes, I'll be at Summit, look me up!
T
April 01, 2008, 10:44 AM
susannahaaaaaaaaaaarrrrrrrrrrrrggggggggggggggggghhhhhhhhh
Fell for it.
Hook, line, and sinker.
April 01, 2008, 10:58 AM
GlendaBy the time I got to my email, several others had already responded so I new it was an April's Fool item. But I had to run the code any way to see the output. Good one.
April 01, 2008, 11:03 AM
Tony AI even left clues for folks such as checking the current date and the hour being LE 12.
Another clue was the class within the style sheet as well as the hex colour code in the HTML.
Hope it gave you all a laugh, it was tough waiting for someone to take the bait
T