
Edit an item in Panel embedded table

Hallo eveyone,
The top line is to call up a graph macro or function and using a selected date-time from a 20k wave from a table to set the bottom axis range. The date time format used is, for example 20240812 02:57:42.608. To select the data requires the date time wave and many other paarmeters to be scrolled and the date time point from the table to be copied by selection with mouse.
What I have arrived at is to use a single point wave in a panel embedded table and pasting the item into it.
// Insert table for edit/pasting date time for plot control string editTable1 ="root:PlotControl:editDateTime" Edit/W=(360,510,490,530)/HOST=Panel_loadUtility $editTable1 ModifyTable frameStyle=0,format(Point)=1, width(point)=500 modifyTable size=11,alignment($editTable1)=0, width($editTable1)=200 modifyTable showparts=0, rgb= (0,0,63000), entrymode = 1, format =8 modifyTable showFracSeconds=1, viewSelection
With showparts = 0 as above the embedded table shows the date-time value at point 0 and values can be pasted and copied as expected. The date-time can be usd by a graph macro with just a few clicks in the panel. The layout is shown in the first panel snippet below.
// Insert table for edit/pasting date time for plot control string editTable1 ="root:PlotControl:editDateTime" Edit/W=(340,510,500,530)/HOST=Panel_loadUtility $editTable1 ModifyTable frameStyle=0,format(Point)=1, width(point)=500 modifyTable size=11,alignment($editTable1)=0, width($editTable1)=200 modifyTable showparts=1, rgb= (0,0,63000), entrymode = 1, format =8 modifyTable showFracSeconds=1, viewSelection
With showparts = 1 above the embedded table shows the edit cell of the table. See second snippet.
How is the table edit cell controlled and formatted to look like the showparts = 0. i.e. font size and single box?


Not answering you question at all, but I wonder why you don't just have a normal (SetVariable) control in your panel to work on the table data if your goal is to edit a single cell anyway. But maybe I don't get what you are trying to do ...
June 2, 2025 at 07:04 am - Permalink
The problem I found was setting the variable to the Date-time format I needed. I know it is an awkward way, but I do not know/cannot find a way of pasting a date time copied with that format into a normal SetVariable.
June 2, 2025 at 08:31 am - Permalink
If you're willing to write conversion/parsing code, you could use a string-based SetVariable.
June 2, 2025 at 12:46 pm - Permalink
But I'm afraid I don't understand what your goal is- what is the purpose of the single-cell table? To edit a time/date value?
June 2, 2025 at 12:47 pm - Permalink
I realized that SetVariable / printf offer no direct date/time conversion, so my suggestion was not very helpful. You could write your own parsing code, as John suggested to transfer from/to the (string) SetVariable control every time there is a change. Here are two conversion functions for this purpose (I use the format "2025/06/03 05:27:13.064" here):
June 2, 2025 at 06:57 pm - Permalink
It was a cludge to cut and paste a cell in table somewhere so that I could then use the value to set the bottom axes of a graph. I used a space on a panel to have another table into which I paste it. It would have been neater if something could be done on the control bar of the graph.
However, from the above comments (thanks to all) I now realise something about dates in tables that I had never thought of before: i.e. a date-time wave is stored as double precision variable but when a cell is shown in a table in the form I use (YYYYMMDD hh:mm:ss.sss) it is of course a string. So copy and paste takes the string representation of the date-time not the DP value. When pasting into another table it is recognised that it is a DP in the format copied and is transferred correctly.
When I had tried pasting into a setvariable and again realise why I could not get it to function.
The way is as nicely shown by chozo - to do a conversion. And it will fit on the control bar of the graph.
.... a very useful training exercise for the never-to-old-to-learn from the guys-who-know-their-stuff.
June 4, 2025 at 09:02 am - Permalink
chozo
I am not familiar with the parsing using SplitString. I can see the structure in the parse string representing the elements of the date time string and it seems OK but I the print below returns NaN
print stringToTime("20240801 00:00:30.793")
June 4, 2025 at 09:29 am - Permalink
Mike- SplitString uses regular expressions to break up a string into components. I have heard it said, "I had a problem and solved it with regular expressions. Now I have two problems."
But they are very seductive because they are very powerful. I know that a few of our Igor power users (like chozo) use them a lot. But it's possible that you fed SplitString with a string that chozo didn't expect. With chozo helping you, you are getting the very best advice!
June 4, 2025 at 10:05 am - Permalink
Yes, regex is great at solving an issue like this while creating two news ones. :-) But SplitString is great for parsing strings you exactly know the format of.
If you don't use the '/' separator in the date, you could simply remove it from SplitString (here, represented by a preceding \ ,i.e., '\/' because this character needs to be escaped). BUT, I don't think you can teach timeToString() to output something like "20240801 00:00:30.793", because you (as far as I know) cannot have no separator in the date. This would make your back and forth conversion quite complicated (and a bit hard to read as I would think). How about using the default dashes instead, i.e.,
"2024-08-01 00:00:30.793"?
June 4, 2025 at 11:02 am - Permalink
In reply to Yes, regex is great at… by chozo
ReplaceString("-", Secs2Date(tval, -2), "")
It's not so very ugly?
June 5, 2025 at 02:43 am - Permalink
The community and databases I interact with use the "YYYYMMDD hh:mm:ss.sss" format. As it is fixed here's my way to skin the cat
I can use it with setvariable and remove my table cludge. Thanks for solution.
June 5, 2025 at 03:05 am - Permalink
@Tony: Yeah, that is a solution. Sometimes I fail to see the obvious, I guess.
June 5, 2025 at 03:24 am - Permalink