epics-base / pva2pva

PV Access gateway/proxy and EPICS Process Database integration
https://epics-base.github.io/pva2pva/
Other
4 stars 13 forks source link

Is there a way to indicate the column order for NTTable created with qsrv ? #61

Open gabrielfedel opened 4 months ago

gabrielfedel commented 4 months ago

During some tests I noticed that a NTTable built using qsrv (it seems to happens on qsrv2 also) will have its column showed in the alphabetical order (if +putorder is not set). Not sure if here is the place, maybe is an issue of showing the table (the same issue appears on pvget and phoebus).

A database example:

record(waveform, "$(P)EvtLbls")                                      
{                                                                    
  field(DESC, "Events Labels")                                       
  field(FTVL, "STRING")                                              
  field(NELM, "2")                                                   
  field(INP,  "['Name', 'Code']")                                    
  field(PINI, "YES")                                                 
  info(Q:group, {                                                    
      "$(P)RefEvents-SP" :{                                          
           +id:"epics:nt/NTTable:1.0",                               
           "labels":{+type:"plain", +channel:"VAL", +putorder:1}     
       },                                                            
       "$(P)RefEvents-RB" :{                                         
           +id:"epics:nt/NTTable:1.0",                               
           "labels":{+type:"plain", +channel:"VAL"}                  
       }                                                             
  })                                                                 
}                                                                    

record(waveform, "$(P)ScEvtNames-SP")                                
{                                                                    
  field(DESC, "EventNames")                                          
  field(FTVL, "STRING")                                              
  field(NELM, "255")                                                 
  field(INP,  "['SeqEnd']")                                          

  info(Q:group, {                                                    
      "$(P)RefEvents-SP" :{                                          
           "value.names":{+type:"plain", +channel:"VAL", +putorder:2}
       },                                                            
      "$(P)RefEvents-RB" :{                                          
           "value.names":{+type:"plain", +channel:"VAL"}             
       }                                                             
  })                                                                 
}                                                                    

record(waveform, "$(P)ScEvtCodes-SP")                                
{                                                                    
  field(DESC, "EventCodes")                                          
  field(FTVL, "UCHAR")                                               
  field(NELM, "255")                                                 
  field(INP,  "[127]")                                               

  info(Q:group, {                                                    
      "$(P)RefEvents-SP" :{                                          
           "value.codes":{+type:"plain", +channel:"VAL", +putorder:3}
       },                                                            
      "$(P)RefEvents-RB" :{                                          
           "value.codes":{+type:"plain", +channel:"VAL"}             
       }                                                             
  })                                                                 
}                                                                    

On that example, I would get:

$ pvget TESTLABEL:RefEvents-SP
TESTLABEL:RefEvents-SP 
  Name Code
SeqEnd  127
$ pvget TESTLABEL:RefEvents-RB
TESTLABEL:RefEvents-RB 
Name   Code
 127 SeqEnd

For the second NTTable, the columns are being displayed ordered by the name of the column (code, name), but I miss a way to display them as name, column.