Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
TagName | Fill A Time | Fill B Time | Fill C Time |
Tag A | 06:00 | ||
Tag A | 06:05 | ||
Tag A | 06:09 | ||
Tag B | 06:02 | ||
Tag B | 06:03 | ||
Tag B | 06:05 | ||
Tag B | 06:06 | ||
Tag C | 06:03 | ||
Tag C | 06:05 | ||
Tag C | 06:07 |
can anyone, please help me, is there a way to get the last value for each field in the table..
To be clear, in the above situation, for each tag I will have lot of rows, but I am interested in the last row of each Tagname. Is there a way to get a last record for each value.
usually, we use Peak function to get the Filed value in a Table,we have to give the row number for accessing the value..
In my case, each tag will have more than one value and i will have no idea, which row number i should give in the peek function.
Is there a way to do it using peek function or do we have any other function..
please help me with this
Thank you
I am fine , thanks you .
Try like this :
vAMax= Timestamp(max([Fill A Time]),'YYYY-MM-DD hh:mm:ss')
//if your getting the null value try with this condition
if(trim(len([Fill A Time]))>0,Timestamp(max([Fill A Time]),'YYYY-MM-DD hh:mm:ss'))
Hi Manuel
Can we use Resident keyword to access the table which we got by using Resident Keyword..
To be clear,, can we use Resident Keyword two Times?? I have already used Resident Keyword to get the Fill A Time, Fill B Time, Fill C Time...
I have used the resident keyword two times, than i got the error as "invalid Expression"..
Thank you
Ganesh
HI Avinash
i have used that already,, but didnt work
Thank you
But interestingly,, i am getting the correct value, when i use the expression in Text box
what is the value your getting ??
In script, I am getting error
In text object.. Exact dateTime that i needed..
But, I want that datetime in a variable and than use it further
Hi Ganesh,
You can use Resident ever you want to get data from a resident table.
I have used this code:
YourTable:
LOAD * INLINE [
TagName, Fill A Time, Fill B Time, Fill C Time
Tag A, 6:00, ,
Tag A, 6:05, ,
Tag A, 6:09, ,
Tag B, , 6:02,
Tag B, , 6:03,
Tag B, , 6:05,
Tag B, , 6:06,
Tag C, , , 6:03
Tag C, , , 6:05
Tag C, , , 6:07
];
Max:
LOAD
TagName,
TagName as TagName2,
RangeMax(Max([Fill A Time]),Max([Fill B Time]),Max([Fill C Time])) as MaxValue
RESIDENT YourTable
GROUP BY TagName;
For i = 0 to NoOfRows('Max')-1
LET vNameVar = Replace(Peek('TagName2',$(i),'Max'),' ','');
LET v$(vNameVar) = Time(Peek('MaxValue',$(i),'Max'),'hh:mm');
Next i
And this is the result:
Regards!!
with the variable your not getting the values ?? create the variable in the front end and assign the expression you have used in the text box..that should give you the results and you could use this variable in future too ..
could you share your script ? to check how your defining the variable
Hi Manuel
But i tried it by using the Resident keyword two times,, but I am getting the error as invalid expression,
I am getting the error exactly at the table name of max Table
Hi Ganesh,
Could you share your code?
Have you added the Group by with all the fields that aren't on the aggregation expressions?
Regards!!