Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, when i try to use this function: =peek('PRODOTTO', 1,'FATTI') in a TextBox or in a Variable, the sintax checker return error.
Is there anything i have done wrong?
PRODOTTO is the field, 1 is the record and FATTI is the table.
Thanks
What happens when you put =m_Prod (without the $ and parenthesis) in a text object?
I think we can not write peek function in text box.
Peek() is a script function.
Peek() is inter record function & it is use in back end scripting
Hi,
As said above Peek function is a script function can't be used in UI. However, if you explain what you want to achieve may be someone might point you in right path.
If you are just debugging and wanting to know what the peek function (variable) would return. Then insert EXIT SCRIPT after the peek, reload and go to UI put the variable in a Text box. Dollar sign expand it
If you want the first record from the that field name, you can try something like this:
=SubField(Concat(DISTINCT PRODOTTO, '|'), '|', 1)
The only issue is that the Concat will do a ascending order concatenation and instead of getting the very first entry from that table, you will get first value in the ascending order. To fix this you will have to add a column in your script which would be something like this:
FATTI:
LOAD PRODOTTO,
RowNo() as ID
and so on...
FROM XYZ;
and then use this expression:
=SubField(Concat(DISTINCT PRODOTTO, '|', ID), '|', 1)
Now you concat function will be based on the ID field and your SubField will give you the very first entry from your PRODOTTO field.
HTH
Best,
S
Hi Marco,
Try this let function in scripting and then use variable in text box.
FATTI:
Load
Sum(PRODOTTO) as PRODOTTO
resident main_table;
Let variable=peek('PRODOTTO', 0,'FATTI')
Thanks ,
krish
Hey,
Peek function is not supported in Textbox then how have you used it in textbox. You may tell the description of task you want to do then only any of us may help you.
thanks
Try FieldValue() like below in Text box
=FieldValue('PRODOTTO',1)
Hi
anbu's suggestion is correct, providing PRODOTTO is not a key field (ie present in more than one table in the table viewer.
If PRODOTTO is a key field, you will need to do something in the load script to mark the record with a flag field, or Peek() it into a variable which you can then use in your expression. This also works if it is not a key field.
HTH
Jonathan