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     NewB Question abour Formatting

Read-Only Read-Only Topic
Go
Search
Notify
Tools
NewB Question abour Formatting
 Login/Join
 
Gold member
posted
Hi All!

I've been making a report, and no way it works. I have the following declaration:

 IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos(' | COD_NIVEL | ',' | 
EDIT(COD_CENRES1) | ')>' | NOMBRE | '</a>'; 


Where COD_CENRES1 is a P7 format, and when I do the EDIT, it transforms to a number, so, if the packet of 7, is "12345", the nes COD_CENRES1 becomes 0012345, and in the Javascript function doesn´t crash, but takes this like an octal value.

Is there someway that COD_CENRES could be an integer without zeros?

Dunno if I have explained myself in a good way, I'm from Spain, and don't speak frequently English Roll Eyes

Regards

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



____________________________________________
Ruben Rueda
Consultant
Information Builders Iberica

Web: http://www.eruben.biz

Prod: WF 5.3.4 @ Red Hat Enterprise Linux ES 3 (Taroon Update 6) w/Oracle 9i
Test: WF 5.3.3 @ SUN Solaris 7 w/Oracle 8i
 
Posts: 52 | Location: Madrid | Registered: July 18, 2005Report This Post
Expert
posted Hide Post
Ruben,

Use the FTOA function. Firstly convert your P7 to an F7 and then use something like -

COD_CENRES1_F/F7 = COD_CENRES1;
COD_CENRES1_A/A7 = FTOA(COD_CENRES1_F,'(F7)','A7');

Good luck

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, 2004Report This Post
Gold member
posted Hide Post
Mmm, ok, with that conversions I have a string, but what I want to do is to convert that string to integer, but the problem is if I use the EDIT function with that string generated, it creates a integer but it fills with zeros if the string coverted doesn't have the length I put, I mesn:

COD_CENRES1_F/F7 = COD_CENRES1;
COD_CENRES1_A/A7 = FTOA(COD_CENRES1_F,'(F7)','A7');
IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '","' 
| OD_CENRES1_A | '")>' | NOMBRE | '</a>';


If COD_CENRES1_A has the value now "123" and I do a
 COD_CENRES_INT/I7 = EDIT(COD_CENRES1_A)  
the value now would be 000123....

Know what I mean?

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



____________________________________________
Ruben Rueda
Consultant
Information Builders Iberica

Web: http://www.eruben.biz

Prod: WF 5.3.4 @ Red Hat Enterprise Linux ES 3 (Taroon Update 6) w/Oracle 9i
Test: WF 5.3.3 @ SUN Solaris 7 w/Oracle 8i
 
Posts: 52 | Location: Madrid | Registered: July 18, 2005Report This Post
Expert
posted Hide Post
Ruben,

Using the edit function on a numeric value will add the leading zeroes (as you have experienced) and provide you with an alphanumeric value. You have to have an alphanumeric value because you are including it into an alphanumeric DEFINE as you have discovered. That is why FTOA is the way to provide what you require.

Using FTOA will convert a floating point decimal value to an alphanueric value without those annoying leading zeroes. Once you have the result of the FTOA function you can include that in your DEFINE without the EDIT.

Using COD_CENRES_INT/I7 = EDIT(COD_CENRES1_A); should give you the result 123 in your example and not the leading zeroes unless you have SET LEADZERO=ON elsewhere in your fex.

Consider -
DEFINE FILE CAR
COD_CENRES1/P7 = 123;
COD_CENRES1_F/F7 = COD_CENRES1;
COD_CENRES1_A/A7 = FTOA(COD_CENRES1_F,'(F7)','A7');
COD_CENRES1_I/I7 = EDIT(COD_CENRES1_A);
IDNOMBRE/A200='<a href=javascript:cargaDatos("' | 
COD_CENRES1_A | '","' | COD_CENRES1_A | '")>' | COD_CENRES1_A | '</a>';
END
TABLE FILE CAR
PRINT COD_CENRES1 AS 'Packed'
      COD_CENRES1_F AS 'Float'
      COD_CENRES1_A AS 'Alpha'
      COD_CENRES1_I AS 'Integer'
      IDNOMBRE
      BY COUNTRY NOPRINT
IF RECORDLIMIT EQ 1
END


Copy and paste this into a new fex and run it. The output is -
Packed Float Alpha Integer  IDNOMBRE
   123   123 123       123  123

and the a href code will be -
<a href=javascript:cargaDatos("    123","    123")>    123</a>


T

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



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, 2004Report This Post
Gold member
posted Hide Post
I've been playing with javascript too, so I've coded a little bit having this:

 COD_CENRES1_F/F7 = COD_CENRES1;
COD_CENRES1_A/A7 = FTOA(COD_CENRES1_F,'(F7)',COD_CENRES1_A);
IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '", 
parseInt("' | COD_CENRES1_A | '",10))>' | NOMBRE | '</a>';
 


If I refresh, and click right button/properties, the link is
 javascript:cargaDatos("A0", 
, doesn't appear complete, but if I see source code I have:
 <a href=javascript:cargaDatos("A0", parseInt("      0",10))>Algeciras                     
</a> 


But it gives me error when I click the link above, because of the spaces? Dunno Frowner

Any ideas?

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



____________________________________________
Ruben Rueda
Consultant
Information Builders Iberica

Web: http://www.eruben.biz

Prod: WF 5.3.4 @ Red Hat Enterprise Linux ES 3 (Taroon Update 6) w/Oracle 9i
Test: WF 5.3.3 @ SUN Solaris 7 w/Oracle 8i
 
Posts: 52 | Location: Madrid | Registered: July 18, 2005Report This Post
Expert
posted Hide Post
One point -

If you are using the values passed to your JavaScript function as integer values then you might need to lose the double quotes in your define -

IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '",' | 
COD_CENRES1_A | ')>' | NOMBRE | '</a>'


T

This message has been edited. Last edited by: Kerry,
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Gold member
posted Hide Post
This is the never ending post about formating haha...

Finally, I got:

 	COD_CENRES1_F/F7 = COD_CENRES1;
	COD_CENRES1_A/A7 = FTOA(COD_CENRES1_F,'(F7)','A7');
	COD_CENRES1_I/I7 = EDIT(COD_CENRES1_A);

-*  IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '", 
parseInt("' | COD_CENRES1_A | '",10))>' | NOMBRE | '</a>';
	IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '",' 
| COD_CENRES1_I | ')>' | NOMBRE | '</a>'; 


If I display these fields, FOCUS shows the values ok, but in Javascript not, why? I get in the second parameter some **** characters and doesn't look like that the function works properly.



Frowner

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



____________________________________________
Ruben Rueda
Consultant
Information Builders Iberica

Web: http://www.eruben.biz

Prod: WF 5.3.4 @ Red Hat Enterprise Linux ES 3 (Taroon Update 6) w/Oracle 9i
Test: WF 5.3.3 @ SUN Solaris 7 w/Oracle 8i
 
Posts: 52 | Location: Madrid | Registered: July 18, 2005Report This Post
Expert
posted Hide Post
Ruebn,

Read my last post and you will have your solution - i.e. get rid of the parseInt function in your JavaScript call, you do not need it. Just get rid of the double quotes around your second parameter.

IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '",' | 
COD_CENRES1_A | ')>' | NOMBRE | '</a>'



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, 2004Report This Post
Gold member
posted Hide Post
No way it works Frowner

The only declaration that gimme no error is:

 IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '",' 
    | EDIT(COD_CENRES1) | ')>' | NOMBRE | '</a>'; 


The other with the converted formats gives javascript errors, that include:

 
-*IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '", 
    parseInt("' | COD_CENRES1_A | '",10))>' | NOMBRE | '</a>';

-*IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '",' 
    | COD_CENRES1_I | ')>' | NOMBRE | '</a>';

-*IDNOMBRE/A200=ID|'<a href=javascript:cargaDatos("' | COD_NIVEL | '",' 
    | COD_CENRES1_A | ')>' | NOMBRE | '</a>';
 

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



____________________________________________
Ruben Rueda
Consultant
Information Builders Iberica

Web: http://www.eruben.biz

Prod: WF 5.3.4 @ Red Hat Enterprise Linux ES 3 (Taroon Update 6) w/Oracle 9i
Test: WF 5.3.3 @ SUN Solaris 7 w/Oracle 8i
 
Posts: 52 | Location: Madrid | Registered: July 18, 2005Report This Post
Expert
posted Hide Post
Ruben, if the problem is spaces in the JavaScript function call, try the following:

IDNOMBRE/A200=ID|'<a href=java_script:cargaDatos["' || COD_NIVEL || '",' || COD_CENRES1_A || ')>' || NOMBRE || '</a>';

Use "hard concatenation" instead of "soft concatenation" to eliminate leading spaces in Dialog Manager variables.

This message has been edited. Last edited by: Francis Mariani,


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Francis Mariani you're right, tomorrow I'll use the other concatenation, and then I'll see what happen....

I'm going crazy with this!!

Thanks Francis Big Grin



____________________________________________
Ruben Rueda
Consultant
Information Builders Iberica

Web: http://www.eruben.biz

Prod: WF 5.3.4 @ Red Hat Enterprise Linux ES 3 (Taroon Update 6) w/Oracle 9i
Test: WF 5.3.3 @ SUN Solaris 7 w/Oracle 8i
 
Posts: 52 | Location: Madrid | Registered: July 18, 2005Report This Post
Gold member
posted Hide Post
At this moment I've been able to pass parameters ok, the solution I adopted is a mix of what we have written before.

Here goes:

My problem was calling a function in javascript created in a define table, one parameter must be alpha and the other one must be integer, but with several conversion, Javascript didn't transform any integer 00XXXX because of Javascript taked this value like octal.

So, the solution was trasnfors COD_CENRES1 from P7 to A7, after this, in the define I already can call parseInt Javascript function form transform an alphanumerical value to integer in base 10, since Javascript was playing in base octal, so the result is:

 IDNOMBRE/A200=ID|'<a href="javascript:cargaDatos('''|COD_NIVEL|''',
    parseInt('''|EDIT(COD_CENRES1)|''',10))">' | NOMBRE | '</a>'; 


Hope it helps in the future all this Wink

Thanks to everybody who helped me and give some ideas to this, many many thanks

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



____________________________________________
Ruben Rueda
Consultant
Information Builders Iberica

Web: http://www.eruben.biz

Prod: WF 5.3.4 @ Red Hat Enterprise Linux ES 3 (Taroon Update 6) w/Oracle 9i
Test: WF 5.3.3 @ SUN Solaris 7 w/Oracle 8i
 
Posts: 52 | Location: Madrid | Registered: July 18, 2005Report 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     NewB Question abour Formatting

Copyright © 1996-2020 Information Builders