Manual sobre pictures

Manual sobre pictures

Postby softruz » Thu Jul 21, 2011 6:15 am

Muy buenas, tendría alguien un manual sobre pictures, es decir, todos los posibles pictures que tengamos.

Un Saludo.
softruz
 
Posts: 485
Joined: Fri Feb 09, 2007 10:34 am

Re: Manual sobre pictures

Postby Carlos Mora » Thu Jul 21, 2011 7:46 am

Softruz,

para la funcion TRANSFORM de la Norton Guide de Clipper:


Code: Select all  Expand view
TRANSFORM()
 Convert any value into a formatted character string
------------------------------------------------------------------------------
 Syntax

     TRANSFORM(<exp>, <cSayPicture>) --> cFormatString

 Arguments

     <exp> is the value to be formatted.  This expression can be any
     valid CA-Clipper data type except array, code block, and NIL.

     <cSayPicture> is a string of picture and template characters that
     describes the format of the returned character string.

 Returns

     TRANSFORM() converts <exp> to a formatted character string as defined by
     <cSayPicture>.

 Description

     TRANSFORM() is a conversion function that formats character, date,
     logical, and numeric values according to a specified picture string that
     includes a combination of picture function and template strings.
     TRANSFORM() formats data for output to the screen or the printer in the
     same manner as the PICTURE clause of the @...SAY command.

     ¦  Function string:  A picture function string specifies
        formatting rules that apply to the TRANSFORM() return value as a
        whole, rather than to particular character positions within <exp>.
        The function string consists of the @ character, followed by one or
        more additional characters, each of which has a particular meaning
        (see table below).  If a function string is present, the @ character
        must be the leftmost character of the picture string, and the
        function string must not contain spaces.  A function string may be
        specified alone or with a template string.  If both are present, the
        function string must precede the template string, and the two must be
        separated by a single space.

        TRANSFORM() Functions
        ---------------------------------------------------------------------
        Function     Action
        ---------------------------------------------------------------------
        B            Displays numbers left-justified
        C            Displays CR after positive numbers
        D            Displays date in SET DATE format
        E            Displays date in British format
        R            Nontemplate characters are inserted
        X            Displays DB after negative numbers
        Z            Displays zeros as blanks
        (            Encloses negative numbers in parentheses
        !            Converts alphabetic characters to uppercase
        ---------------------------------------------------------------------

     ¦  Template string:  A picture template string specifies
        formatting rules on a character-by-character basis.  The template
        string consists of a series of characters, some of which have special
        meanings (see table below).  Each position in the template string
        corresponds to a position in the value of the <exp> argument.
        Because TRANSFORM() uses a template, it can insert formatting
        characters such as commas, dollar signs, and parentheses.

        Characters in the template string that have no assigned meanings are
        copied literally into the return value.  If the @R picture function
        is used, these characters are inserted between characters of the
        return value; otherwise, they overwrite the corresponding characters
        of the return value.  A template string may be specified alone or
        with a function string.  If both are present, the function string
        must precede the template string, and the two must be separated by a
        single space.

        TRANSFORM() Templates
        ---------------------------------------------------------------------
        Template     Action
        ---------------------------------------------------------------------
        A,N,X,9,#    Displays digits for any data type
        L            Displays logicals as "T" or "F"
        Y            Displays logicals as "Y" or "N"
        !            Converts an alphabetic character to uppercase
        $            Displays a dollar sign in place of a leading space in a
                     numeric
        *            Displays an asterisk in place of a leading space in a
                     numeric
        .            Specifies a decimal point position
        ,            Specifies a comma position
        ---------------------------------------------------------------------

 Examples

     ¦  This example formats a number into a currency format using a
        template:

        ? TRANSFORM(123456, "$999,999")    // Result: $123,456

     ¦  This example formats a character string using a function:

        ? TRANSFORM("to upper", "@!")      // Result: TO UPPER
 


Y para los GETs:


Code: Select all  Expand view

     PICTURE: When you specify the PICTURE clause for a GET, the
     character string specified by <cGetPicture> controls formatting and edit
     validation.  The picture string controls the display format like a SAY
     picture.  It also controls the way the user can edit the buffer.  A
     picture string consists of two distinct parts, a function string and a
     template string, either or both of which may be present.

     ¦  Function string: A PICTURE function string specifies
        formatting or validation rules which apply to the GET's display value
        as a whole, rather than to particular character positions within it.
        The function string consists of the @ character, followed by one or
        more additional characters, each of which has a particular meaning
        (see the following table).  The function string must be the first
        element of a PICTURE clause and cannot contain spaces.  A function
        string may be specified alone or with a template string.  If both are
        present, the function string must precede the template string, and
        the two must be separated by a single space.

        GET PICTURE Format Functions
        ---------------------------------------------------------------------
        Function     Type Action
        ---------------------------------------------------------------------
        A            C    Allows only alphabetic characters.
        B            N    Displays numbers left-justified.
        C            N    Displays CR after positive numbers.
        D            D,N  Displays dates in SET DATE format.
        E            D,N  Displays dates with day and month inverted
                          independent of the current DATE SETting, numerics
                          with comma and period reverse (European style).
        K            ALL  Deletes default text if first key is not a cursor
                          key.
        R            C    Nontemplate characters are inserted in the display
                          but not saved in the variable.
        S<n>         C    Allows horizontal scrolling within a GET.  <n> is
                          an integer that specifies the width of the region.
        X            N    Displays DB after negative numbers.
        Z            N    Displays zero as blanks.
        (            N    Displays negative numbers in parentheses with
                          leading spaces.
        )            N    Displays negative numbers in parentheses without
                          leading spaces.
        !            C    Converts alphabetic character to uppercase.
        ---------------------------------------------------------------------

     ¦  Template string:  A PICTURE template string specifies
        formatting or validation rules on a character by character basis.
        The template string consists of a series of characters, some of which
        have special meanings (see the following table).  Each position in
        the template string corresponds to a position in the displayed GET
        value.  Characters in the template string that do not have assigned
        meanings are copied verbatim into the displayed GET value.  If you
        use the @R picture function, these characters are inserted between
        characters of the display value, and are automatically removed when
        the display value is reassigned to <idVar>; otherwise, they overwrite
        the corresponding characters of the display value and also affect the
        value assigned to <idVar>.  You may specify a template string alone
        or with a function string.  If you use both, the function string must
        precede the template string, and the two must be separated by a
        single space.

        GET PICTURE Template Symbols
        ---------------------------------------------------------------------
        Template     Action
        ---------------------------------------------------------------------
        A            Allows only alphabetic characters
        N            Allows only alphabetic and numeric characters
        X            Allows any character
        9            Allows digits for any data type including sign for
                     numerics
        #            Allows digits, signs and spaces for any data type
        L            Allows only T, F, Y or N
        Y            Allows only Y or N
        !            Converts an alphabetic character to uppercase
        $            Displays a dollar sign in place of a leading space in a
                     numeric
        *            Displays an asterisk in place of a leading space in a
                     numeric
        .            Displays a decimal point
        ,            Displays a comma
        ---------------------------------------------------------------------
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Manual sobre pictures

Postby softruz » Thu Jul 21, 2011 7:57 am

Muchas gracias, esto es muy util.

Un Saludo.
softruz
 
Posts: 485
Joined: Fri Feb 09, 2007 10:34 am

Re: Manual sobre pictures

Postby softruz » Wed Jul 27, 2011 7:15 am

Muchas gracias.
softruz
 
Posts: 485
Joined: Fri Feb 09, 2007 10:34 am

Re: Manual sobre pictures

Postby QAZWSX2K » Wed Jul 27, 2011 5:40 pm

ALGUNOS EJEMPLITOS UTILES

FUNCTION Start() AS VOID

LOCAL nNumber AS FLOAT

// Transform examples

? Transform(123.45,"@B 99999.99")

? Transform(3.45,"@B 99999.99")

? Transform(123.45,"@C 99999.99")

? Transform(-123.45,"@X 99999.99")

? Transform(123.45,"@Z 99999.99")

? Transform(0,"@Z 99999.99")

? Transform(0,"99999.99")

? Transform(-123.45,"@( 99999.99")

? Transform(-123.45,"@(XC 99999.99")

// Date/time examples

? ElapTime("03:02:01", "09:09:09") // 06:07:08

? ElapTime("09:05:12", "23:10:07") // 14:04:55

? Time24(), AmPm(Time24())

SetAMExt(" am")

SetPMExt(" pm")

SetAmPm(TRUE)

? Today(), DToS(Today()), DToC(Today()), DoW(Today()), Day(Today()), CDoW(Today())

? Days(300000)

? TString(303600)

? TString(10400)



// String examples

? "1234567890123456"

? Str(5.4500,12,-1)

? Str(123.458,12,2)

? Str(234.4563456456,12,-1)

? Str(234.4563456456,12,2)

? Str(23.5,10,5)

SetScience(TRUE)

? Str(353425234.56746,-1)

nNumber := 123.45

? Str(nNumber) // 123.45

? Str(nNumber, 4) // 123.

? Str(nNumber, 2) // **

? Str(nNumber * 10, 7, 2) // 1234.50

? Str(nNumber * 10, 12, 4) // 1234.5000

? Str(nNumber, 10, 1) // 123.5

? Str(123.45, -1) // 123.45

? Str(123.45, -1, 2) // 123.45

? Str(0.45000, 14, -1) // 0.45000

? Str(5.45000, 14, -1) // 5.45000

? Str(5.4500, 14, -1) // 5.4500

// Insert

? Stuff("ABCDEF", 2, 0, "xyz") // AxyzBCDEF

// Replace

? Stuff("ABCDEF", 2, 3, "xyz") // AxyzEF

// Delete

? Stuff("ABCDEF", 2, 2, "") // ADEF

// Replace and insert

? Stuff("ABCDEF", 2, 1, "xyz") // AxyzCDEF

// Replace and delete

? Stuff("ABCDEF", 2, 4, "xyz") // AxyzF

// Replace and delete rest

? Stuff("ABCDEF", 2, 10, "xyz") // Axyz



RETURN
Software especializado para oficinas contables con grandes volumenes de Informacion
Impresion de todos los formularios del Seniat, Dian

alex_patino74@hotmail.com
whatsapp 57+3214777217
User avatar
QAZWSX2K
 
Posts: 364
Joined: Tue Oct 25, 2005 7:06 pm
Location: Bogota - Caracas

Re: Manual sobre pictures

Postby Carlos Mora » Thu Jul 28, 2011 7:47 am

Hola Alex,

No sabía lo de usar el -1 en Str(). Lo he buscado en la documentación de Clipper y en la de xHarbour (online) y no la encontré.
Veo que usas xHarbour. Probando con el xBScript y xHarbour 0.99.60, tengo un comportameinto diferente:

Code: Select all  Expand view


? str( 324.6666334, 16, -1 ) // 325
? str( 324.6666334, -1 ) // 325
? str( 324.6666334, -1, 5 ) // 324,66663

 

¿Cual debería ser el comportamiento?
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Manual sobre pictures

Postby Patricio Avalos Aguirre » Thu Jul 28, 2011 4:40 pm

Hola

la sintaxis del STR

Code: Select all  Expand view
Syntax
Str( <nNumber>   , ;
    [<nLength>]  , ;
    [<nDecimals>], ;
    [<lTrim>]      ) --> cString

Arguments
<nNumber>
A numeric value to convert to a character string.
<nLength>
An optional numeric value specifying the length of the return string, including sign and decimal places.
<nDecimals>
This is an optional numeric value indicating the number of decimal places to return.
<lTrim>
This parameter defaults to .F. (false). When .T. (true) is passed, the returned string has no leading spaces. Return
The function returns <nNumber> formatted as a character string.
 
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: Manual sobre pictures

Postby Carlos Mora » Fri Jul 29, 2011 4:17 pm

Patricio,

gracias por la respuesta, pero lo que no encontré documentado es el uso del -1 como parámetro, que tampoco me lo explica la definición que pusiste.

Un saludo
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 74 guests