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.
I am not sure that is what TNVP is really looking for? More like a hex string to find the decimal equivalent?
TNVP,
This is a basic maths problem in which you will have to interpret each component of your hex string to obtain the decimal equivalent. You could do that via a simple decode. If you have a max size of the hex string (say x'FF') then you could use an external decode file.
So many ways and methods of doing what I think that you are asking, that really it is best for you to initially analyse your specific requirements and work towards your solution with that in mind.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
JG, I only noticed because the match sticks hadn't broken this moring
To complement your DM solution, here's one using a flat file format from my library of useful code (uses autoprompt). It could be used to dump the Hex strings into a temporary table and then pull out the Integer values. If the user enters an invalid character then '0' is substituted.
-SET &Dummy = &Hexstr.Please enter a hex string.;
-* Sting prefixed with 'x' as REVERSE doesn't seem to like pure numerics!
-SET &Hexlen = ARGLEN(999, 'x &Hexstr.EVAL', 'I3');
-SET &Hexout = UPCASE(10,REVERSE(10,REVERSE(&Hexlen,'x &Hexstr.EVAL','A&Hexlen.EVAL'),'A10'),'A10');
FILEDEF HEXTOINT DISK HEXTOINT.ftm
-RUN
EX -LINES 5 EDAPUT MASTER,HEXTOINT,CF,MEM,FILENAME=HEXTOINT, SUFFIX=FIX,$
SEGNAME=ONE, SEGTYPE=S0, $
FIELD=HEXSTRING, ,A10 ,A10 ,$
SEGNAME=TWO, PARENT=ONE, OCCURS=10, POSITION=HEXSTRING, SEGTYPE=S, $
FIELD=HEXCHAR, ,A1 ,A1 ,$
-RUN
-WRITE HEXTOINT &Hexout
-RUN
TABLE FILE HEXTOINT
PRINT HEXCHAR
COMPUTE VAL/I3 = IF HEXCHAR FROM 'A' TO 'F' THEN BYTVAL(HEXCHAR, 'I3') - 55
ELSE IF HEXCHAR FROM '1' TO '9' THEN BYTVAL(HEXCHAR, 'I3') - 48
ELSE 0;
COMPUTE CNT/I2 = IF HEXSTRING EQ LAST HEXSTRING THEN CNT + 1 ELSE 0;
COMPUTE POWER/I2 = 9 - CNT;
COMPUTE HEXINT/D20c = VAL * (16 ** POWER);
BY HEXSTRING
ON TABLE HOLD
END
-RUN
-*HOLD
TABLE FILE HOLD
SUM HEXINT
BY HEXSTRING
END
-RUN
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Plus a quick example of using it from extracted output -
EX -LINES 5 EDAPUT MASTER,HEXTOINT,CF,MEM,FILENAME=HEXTOINT, SUFFIX=FIX,$
SEGNAME=ONE, SEGTYPE=S0, $
FIELD=HEXSTRING, ,A10 ,A10 ,$
SEGNAME=TWO, PARENT=ONE, OCCURS=10, POSITION=HEXSTRING, SEGTYPE=S, $
FIELD=HEXCHAR, ,A1 ,A1 ,$
-RUN
TABLE FILE CAR
BY COUNTRY
ON TABLE SAVE AS HEXTOINT
END
-RUN
TABLE FILE HEXTOINT
PRINT HEXCHAR
COMPUTE VAL/I3 = IF HEXCHAR FROM 'A' TO 'F' THEN BYTVAL(HEXCHAR, 'I3') - 55
ELSE IF HEXCHAR FROM '1' TO '9' THEN BYTVAL(HEXCHAR, 'I3') - 48
ELSE 0;
COMPUTE CNT/I2 = IF HEXSTRING EQ LAST HEXSTRING THEN CNT + 1 ELSE 0;
COMPUTE POWER/I2 = 9 - CNT;
COMPUTE HEXINT/D20c = VAL * (16 ** POWER);
BY HEXSTRING
ON TABLE HOLD
END
-RUN
TABLE FILE HOLD
SUM HEXINT
BY HEXSTRING
END
-RUN
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Too true Frank, but then he did ask fairly nicely and also JG had given him a suggestion before me. I was just adding to JG's suggestion as a possible TABLE process option
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Because WebFOCUS has so many manuals, HEXBYT and BYTVAL/BITVAL will be found under functions. If you are using DevStudio the DEFINE tool has Functions will step you through the code.
WebFOCUS & ReportCaster 8.1.05, 7.7.03 - AIX/LINUX, FOCUS 7.6.13 MVS, Output PDF, XLS-XLSX, DOCX and HTML
Posts: 146 | Location: Atlanta, GA | Registered: May 31, 2007
That is actually a slightly different issue as you are not actually converting a hex string to decimal you are converting 3 parts of a hex string to three decimals and to be honest it is much easier to achive.
All you have to do is create a decode table either as a flat file or as inline code then edit the hex value into its 3 pairs and decode them to the decimal values. finally combine the decimals to give the RBG
Originally posted by T.N.V.Pandian: Thank you JG,T,nubi,Frank,Rhonda for your valuable suggestions.
I have a hexadecimal color code.I want to calculate its RGB equivalent. e.x. #ffffff to 255 255 255
This is the issue for which i need guidance.
Thanks in advance
not a problem i just thought that if it was a one off thing you needed to do its better to use something like google as its designed for quick ad-hoc requests...
the other thing you could download is Paint.net, this is a freeware Photoshop copy but more importantly it has a colour pallete which you can enter Hex or RGB into- so you can get the values that way and actually see the colour at the same time.....
Developer Studio 7.64 Win XP Output: mostly HTML, also Excel and PDF
"Never attribute to malice that which can be adequately explained by stupidity." - Heinlein's Razor
Posts: 285 | Location: UK | Registered: October 26, 2007
Here's a Defined function that can be used in Dialogue Manager or WebFOCUS code - it converts one Hex value to one decimal value and can be called multiple time to convert a hex colour value to decimal:
DEFINE FUNCTION HEXTODEC(INHEX/A2)
INHEXA/A1 = EDIT(INHEX, '9$');
INHEXB/A1 = EDIT(INHEX, '$9');
INDECA/I2 =
IF INHEXA GE '0' AND INHEXA LE '9' THEN EDIT(INHEXA) ELSE DECODE INHEXA ('A' 10, 'B' 11, 'C' 12, 'D' 13, 'E' 14, 'F' 15 ELSE 0);
INDECB/I2 =
IF INHEXB GE '0' AND INHEXB LE '9' THEN EDIT(INHEXB) ELSE DECODE INHEXB ('A' 10, 'B' 11, 'C' 12, 'D' 13, 'E' 14, 'F' 15 ELSE 0);
HEXTODECN/I3 = (INDECA * 16) + INDECB ;
HEXTODEC/A3 = EDIT(HEXTODECN);
END
-RUN
-SET &COLOUR_HEX = '#F0F9FC';
-SET &COLOUR_DEC =
- HEXTODEC(EDIT('&COLOUR_HEX.EVAL','$99$$$$')) | ' ' |
- HEXTODEC(EDIT('&COLOUR_HEX.EVAL','$$$99$$')) | ' ' |
- HEXTODEC(EDIT('&COLOUR_HEX.EVAL','$$$$$99'));
-TYPE COLOUR &COLOUR_HEX = &COLOUR_DEC
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server