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
RegardsThis message has been edited. Last edited by: Kerry,
____________________________________________ Ruben Rueda Consultant Information Builders Iberica
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
January 09, 2006, 07:05 AM
rubenibi
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:
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
January 09, 2006, 08:07 AM
Tony A
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 -
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.
This message has been edited. Last edited by: Kerry,
____________________________________________ Ruben Rueda Consultant Information Builders Iberica
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
January 09, 2006, 11:23 AM
Tony A
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.
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
January 09, 2006, 03:10 PM
rubenibi
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
____________________________________________ Ruben Rueda Consultant Information Builders Iberica
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
January 10, 2006, 07:44 AM
rubenibi
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
Thanks to everybody who helped me and give some ideas to this, many many thanksThis message has been edited. Last edited by: Kerry,
____________________________________________ Ruben Rueda Consultant Information Builders Iberica