Uso de Char para comparar valores numéricos y de caracteresHola,
¿Es posible comparar valores numéricos y de caracteres?
Quiero comparar dos columnas (valores idénticos o diferentes). Una columna tiene una fecha numérica y otra tiene una fecha de carácter y, como necesito comparar solo partes, quiero usar una subcadena. El siguiente script se ejecuta, pero no me da el resultado correcto ya que todo parece ser diferente (que no es el caso). ¿Estoy usando Char mal?
If( Substr( Char( :Name( "Date/Time of Specimen Collection" ) ), 1, 10 ) == Substr( :Name( "Start Date/Time of Visit" ), 1, 10 ),
"identical",
"different"
)
Sé que puedo cambiar el formato de "Fecha/hora de recolección de muestras", pero prefiero no hacerlo, ya que complicará otras partes de mi guión.
gracias de antemano
secuencias de comandosRe: Usar Char para comparar valores numéricos y de caracteresPara entender lo que está pasando, haga una columna temporal con
Char( :Name( "Date/Time of Specimen Collection" ) )
como la fórmula. Probablemente necesitará usar la función format(...) (en lugar de char(...)) para especificar el formato exacto de fecha y hora que necesita para obtener todos los valores y caracteres de separación correctos. Puede ver los nombres de formato disponibles cuando usa el cuadro de diálogo de propiedades de columna y mira la sección formato... fecha.
Re: Usar Char para comparar valores numéricos y de caracteresEntiendo tu argumento. Sin embargo, parece que no puedo hacerlo bien usando el formato.
¿Hay alguna forma de hacer esto sin crear columnas adicionales?
Re: Usar Char para comparar valores numéricos y de caracteresSí. ¿Cuál es el formato de la fecha del carácter?
Re: Usar Char para comparar valores numéricos y de caracteresEn el recorte de tabla adjunto, estoy tratando de comparar la parte de la fecha de la columna "Fecha/hora de la recolección de muestras" (numérica, aaaa-mm-ddThh:mm:ss) con la columna "Fecha/hora de inicio de la visita" (carácter , nominal)
¿Existe una función que permita a jmp ver los valores numéricos como caracteres (formateados como una fecha, por supuesto) para que pueda usar una subcadena para la parte de la fecha?
Re: Usar Char para comparar valores numéricos y de caracteres
Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Using the format() function; the numeric date is in year-month-day for 7 February; the character format is in day/month/year.Usando la función de formato (); la fecha numérica está en año-mes-día para el 7 de febrero; el formato de caracteres es en día/mes/año.
Re: Usar Char para comparar valores numéricos y de caracteresEs posible que necesite este formato:
the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.the T format is an ISO standard.el formato T es un estándar ISO.
Re: Usar Char para comparar valores numéricos y de caracteresO incluso esto:
You don't need substr for the yyy-mm-dd format; it already returns just the 10 characters you need.You don't need substr for the yyy-mm-dd format; it already returns just the 10 characters you need.You don't need substr for the yyy-mm-dd format; it already returns just the 10 characters you need.You don't need substr for the yyy-mm-dd format; it already returns just the 10 characters you need.You don't need substr for the yyy-mm-dd format; it already returns just the 10 characters you need.You don't need substr for the yyy-mm-dd format; it already returns just the 10 characters you need.You don't need substr for the yyy-mm-dd format; it already returns just the 10 characters you need.You don't need substr for the yyy-mm-dd format; it already returns just the 10 characters you need.No necesita substr para el formato aaaa-mm-dd; ya devuelve solo los 10 caracteres que necesita.
Re: Usar Char para comparar valores numéricos y de caracteresMuchas gracias, lo intentaré 