cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-36848%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EFormato%20de%20fecha%20para%20un%20SQL%20(OSISOFT%20PI)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-36848%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHola%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDespu%C3%A9s%20de%20algunos%20intentos%2C%20pude%20obtener%20datos%20de%20nuestro%20Archivo%20PI.%20Utilizamos%20PI%20(Osisoft)%20para%20archivar%20los%20datos%20de%20nuestros%20procesos.%3C%2FP%3E%3CP%3ECon%20la%20siguiente%20consulta%20obtuve%20los%20datos%20pero%20la%20marca%20de%20tiempo%20no%20est%C3%A1%3A%3C%2FP%3E%3CPRE%3ESELECT%20t1.tag%2C%20t1.time%2C%20t1.value%2C%20t1.svalue%2C%0A%0At1.status%2C%20t1.flags%0A%0AFROM%20picomp%20t1%0A%0AWHERE%20(%20(%20(%20t1.tag%20%3D%20'AL2_Geschwindigkeit_Linienmotor_Formerstation'%20)%20AND%20(%20(t1.time%20%26gt%3B%3D%20(%20'2017%2F03%2F05%201%3A47%3A16%20PM'%20))%20AND%20(t1.time%20%26lt%3B%3D%20(%20'2017%2F03%2F05%202%3A44%3A40%20PM'%20))%20)%20)%20)%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELa%20columna%20de%20la%20marca%20de%20tiempo%20est%C3%A1%20simplemente%20vac%C3%ADa%20(num%C3%A9rica%2C%20continua).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEntonces%20tuve%20la%20idea%20de%20que%20la%20columna%20de%20la%20marca%20de%20tiempo%20no%20es%20num%C3%A9rica.%20Intent%C3%A9%20convertir%20la%20hora%20en%20fecha%20con%20la%20siguiente%20consulta%3A%3C%2FP%3E%3CPRE%3ESELECT%20t1.tag%2C%20TO_Date(SUBSTR%20(time%2C%201%2C%2015)%2C'yyyymmdd')%20time%2C%20t1.value%2C%20t1.svalue%2C%0A%0At1.status%2C%20t1.flags%0A%0AFROM%20picomp%20t1%0A%0AWHERE%20(%20(%20(%20t1.tag%20%3D%20'AL2_Geschwindigkeit_Linienmotor_Formerstation'%20)%20AND%20(%20(t1.time%20%26gt%3B%3D%20(%20'2017%2F03%2F05%201%3A47%3A16%20PM'%20))%20AND%20(t1.time%20%26lt%3B%3D%20(%20'2017%2F03%2F05%202%3A44%3A40%20PM'%20))%20)%20)%20)%3C%2FPRE%3E%3CP%3EPero%20ah%C3%AD%20me%20sali%C3%B3%20el%20error%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5BPIODBC%5D%20%5BPIOLEDB%5D%20%5BSUBSTR%5D%20Error%20en%20la%20resoluci%C3%B3n%20de%20sobrecarga%20para%20argumentos%20(DateTime%2C%20Int16%2C%20Int16).%20%5BSQLSTATE%3DHY000%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%C2%BFQu%C3%A9%20hice%20mal%3F%3C%2FP%3E%3CP%3EAlguien%20puede%20ayudarme%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-413500%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Formato%20de%20fecha%20para%20SQL%20(OSISOFT%20PI)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-413500%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ES%C3%A9%20que%20esta%20es%20una%20publicaci%C3%B3n%20antigua%2C%20pero%20mira%20la%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FJMP-Add-Ins%2FAveva-OSISoft-PI-Tools%2Fm-p%2F224525%23U224525%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-tkb-thread%20lia-fa-icon%20lia-fa-tkb%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3E%20Herramientas%20de%20PI%20de%20Aveva%2FOSISoft%3C%2FA%3E%20Complemento%2C%20puede%20ayudarle%20a%20escribir%20estas%20consultas.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-36869%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Formato%20de%20fecha%20para%20SQL%20(OSISOFT%20PI)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-36869%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EOk...%20ahora%20funciona%20con%20el%20siguiente%20SQL%3C%2FP%3E%3CPRE%3ESELECT%20t1.tag%2C%20Cast%20(time%20as%20string)%20STRING_time%2C%20t1.value%2C%20t1.svalue%2C%0A%0At1.status%2C%20t1.flags%0A%0AFROM%20picomp%20t1%0A%0AWHERE%20(%20(%20(%20t1.tag%20%3D%20'AL2_Geschwindigkeit_Linienmotor_Formerstation'%20)%20AND%20(%20(t1.time%20%26gt%3B%3D%20(%20'2017%2F03%2F05%201%3A47%3A16%20PM'%20))%20AND%20(t1.time%20%26lt%3B%3D%20(%20'2017%2F03%2F05%202%3A44%3A40%20PM'%20))%20)%20)%20)%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-36865%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Formato%20de%20fecha%20para%20SQL%20(OSISOFT%20PI)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-36865%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EEl%20%22%3B%22%20El%20problema%20sigue%20ah%C3%AD.%20Pero%20ese%20no%20es%20mi%20problema.%20Puedo%20eliminarlo%20f%C3%A1cilmente.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMi%20problema%20es%20que%20no%20tengo%20tiempo.%20Parece%20ser%20que%20JMP%20convierte%20los%20datos%20de%20tiempo%20a%20num%C3%A9ricos.%20Pero%20en%20PI%20Archive%20parece%20ser%20una%20cadena%20o%20algo%20relativo.%20Si%20uso%20Microsoft%20Access%20obtengo%20el%20tiempo.%20Access%20me%20dice%20que%20el%20tipo%20de%20datos%20es%20%22Texto%22.%20Quiz%C3%A1s%20le%20pregunte%20directamente%20a%20OSISOFT%20c%C3%B3mo%20puedo%20obtener%20la%20hora%20mediante%20un%20SQL.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-36863%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Formato%20de%20fecha%20para%20SQL%20(OSISOFT%20PI)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-36863%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ECreo%20que%20el%20%22%3B%22%20El%20problema%20se%20solucion%C3%B3%20en%2013.%20Quiz%C3%A1s%20quieras%20intentarlo%20de%20nuevo.%20Mi%20consejo%20est%C3%A1ndar%20para%20SQL%20es%20dejar%20que%20Query%20Builder%20haga%20la%20codificaci%C3%B3n.%20Si%20desea%20incrustar%20el%20SQL%20en%20una%20aplicaci%C3%B3n%20JSL%20o%20algo%20as%C3%AD%2C%20siempre%20puede%20retirarlo%20despu%C3%A9s%20del%20hecho%2C%20pero%20el%20QB%20hace%20el%20trabajo%20pesado%20para%20que%20sepa%20que%20funciona.%20%3CBR%20%2F%3E%3CBR%20%2F%3EMejor%2C%3CBR%20%2F%3E%3CBR%20%2F%3E%20METRO%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-36852%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Formato%20de%20fecha%20para%20SQL%20(OSISOFT%20PI)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-36852%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EEn%20el%20siguiente%20enlace%20encontrar%C3%A1%20un%20ejemplo%20de%20este%20%22%3B%22%20-Problema%20de%20Osisoft.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechsupport.osisoft.com%2FTroubleshooting%2FKB%2FKB01377%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftechsupport.osisof.com%2FTroubleshooting%2FKB%2FKB01377%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-36850%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Formato%20de%20fecha%20para%20SQL%20(OSISOFT%20PI)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-36850%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EYo%20uso%20JMP%20Pro%2013.1.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EComienzo%20con%20la%20consulta%20Builder.%20Pero%20tengo%20que%20cambiar%20a%20%22SQL%20personalizado%22.%20Porque%20la%20consulta%20del%20Query%20Builder%20no%20funciona.%20Por%20ejemplo%2C%20tengo%20que%20eliminar%20%22%3B%22%20al%20final%20de%20la%20consulta.%20Y%20hay%20algunas%20otras%20cosas.%20Eso%20es%20molesto%20pero%20manejable.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-36849%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Formato%20de%20fecha%20para%20SQL%20(OSISOFT%20PI)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-36849%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EAlgunas%20preguntas%20aqu%C3%AD%3A%20%C2%BFest%C3%A1%20intentando%20codificar%20SQL%20manualmente%20o%20utilizar%20Query%20Builder%3F%20Adem%C3%A1s%2C%20%C2%BFqu%C3%A9%20versi%C3%B3n%20de%20JMP%20est%C3%A1s%20usando%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%20%C2%A1Gracias!%3CBR%20%2F%3E%3CBR%20%2F%3E%20METRO%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
mkennke
Level III

Date Format for a SQL (OSISOFT PI)

Hi,

 

after some trying i was able to get data from our PI Archive. We use PI (Osisoft) to archive our process data.

With the following query I got the data but the timestamp is not there:

SELECT t1.tag, t1.time, t1.value, t1.svalue,

t1.status, t1.flags

FROM picomp t1

WHERE ( ( ( t1.tag = 'AL2_Geschwindigkeit_Linienmotor_Formerstation' ) AND ( (t1.time >= ( '2017/03/05 1:47:16 PM' )) AND (t1.time <= ( '2017/03/05 2:44:40 PM' )) ) ) )

 

The column for the timestamp is just empty (numeric, continous).

 

Then I had the idea that the column for the timestamp is not numeric. I tried to convert the time into date with the follwoing query:

SELECT t1.tag, TO_Date(SUBSTR (time, 1, 15),'yyyymmdd') time, t1.value, t1.svalue,

t1.status, t1.flags

FROM picomp t1

WHERE ( ( ( t1.tag = 'AL2_Geschwindigkeit_Linienmotor_Formerstation' ) AND ( (t1.time >= ( '2017/03/05 1:47:16 PM' )) AND (t1.time <= ( '2017/03/05 2:44:40 PM' )) ) ) )

But there i got the error:

 

[PIODBC] [PIOLEDB] [SUBSTR] Overload resolution failed for (DateTime, Int16, Int16) arguments(s). [SQLSTATE=HY000]

 

What did I wrong?

Can anybody help me?

1 ACCEPTED SOLUTION

Accepted Solutions
mkennke
Level III

Re: Date Format for a SQL (OSISOFT PI)

Ok...now it works with the following SQL

SELECT t1.tag, Cast (time as string) STRING_time, t1.value, t1.svalue,

t1.status, t1.flags

FROM picomp t1

WHERE ( ( ( t1.tag = 'AL2_Geschwindigkeit_Linienmotor_Formerstation' ) AND ( (t1.time >= ( '2017/03/05 1:47:16 PM' )) AND (t1.time <= ( '2017/03/05 2:44:40 PM' )) ) ) )

View solution in original post

7 REPLIES 7

Re: Date Format for a SQL (OSISOFT PI)

A few questions here: are you trying to code the SQL manually or use Query Builder? Also what version of JMP are you using?

Thanks!

M
mkennke
Level III

Re: Date Format for a SQL (OSISOFT PI)

I use JMP Pro 13.1.

 

I start with the query Builder. But I have to switch to "Custom SQL". Because the Query from the Query Builder does not work. For eample I have to delete the " ; " at the end of the query. And there are some other things. Thats annoying but manageable.

mkennke
Level III

Re: Date Format for a SQL (OSISOFT PI)

Under the follwoing link you will find an example for this " ; " -Problem from Osisoft.

https://techsupport.osisoft.com/Troubleshooting/KB/KB01377

Re: Date Format for a SQL (OSISOFT PI)

I think the ";" issue got fixed in 13. You might want to give it a try again. My standard advice for SQL is to let Query Builder do the coding. If you want to embed the SQL in a JSL application or something you can always pull it out after the fact - but the QB do the heavy lifting so you know it works.

Best,

M
mkennke
Level III

Re: Date Format for a SQL (OSISOFT PI)

The ";" issue is still there. But that is not my problem. I can delete it easyly.

 

My Problem is that I do not get the time. It seems to be that JMP converts the time data to numeric. But in the PI Archive it seems to be a string or something relative. If I use Microsoft Access I get the time. Access tells me that the data type is "Text". Maybe I will ask OSISOFT directly how I can get the time by a SQL.

mkennke
Level III

Re: Date Format for a SQL (OSISOFT PI)

Ok...now it works with the following SQL

SELECT t1.tag, Cast (time as string) STRING_time, t1.value, t1.svalue,

t1.status, t1.flags

FROM picomp t1

WHERE ( ( ( t1.tag = 'AL2_Geschwindigkeit_Linienmotor_Formerstation' ) AND ( (t1.time >= ( '2017/03/05 1:47:16 PM' )) AND (t1.time <= ( '2017/03/05 2:44:40 PM' )) ) ) )
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Date Format for a SQL (OSISOFT PI)

I know this is an old post, but check out the Aveva/OSISoft PI Tools Add-in, it can help write these queries for you.

Recommended Articles