How to Set Current record

How to Set Current record

  
Hi everyone!

I have the following scenario
A tableRecord bound to X entity, I added a column with a link. So i need to re-set current record to the correct position.
BTW. When click on the link it not update the current record. Any help...

Hello Mohamed,
 
Can you explain what the link is planned to do? and what do you mean by "So i need to re-set current record to the correct position."
 
If you can please attach a sample of what are you planning to do.
 
Regards,
Hello Hugo,

attached what I mean.

the Calc Link can't not get the correct current row.
Hello Mohamed,

By looking to you example, there are some things that you need to change:
  1. in Calc screen action you need to use TableRecord scope instead of "GetProducts";
  2. You need refresh query to get all update records after the update in Database
  3. An ajax call to refresh table record.
Let me know if helps,
Hugo Pinheiro

Let me know if helps,
Hugo Pinheiro
ohh, just confused between the entity and the widget.

Thank you very much.
Hi Hugo,

In addition to this, can the .CurrentRecordNumber property of the Table Widget be changed during runtime?


Thanks.

Regards,

Christopher
Hello Christopher,

are you talking about the CurrentRowNumber property? if that is the case it's read only, like is mentioned on the online help: http://www.outsystems.com/help/servicestudio/9.0/.

Best Regards,
Hugo Pinheiro
Hi Hugo,

Yes, my objective is that I need is to point the current record for example to Table Row 1 or etc. Then do some calculation/actions for that row.


Thanks Hugo.

Christopher
Hello Christopher,

You can always refer directly to an element in a list using List[index].
For example: Contacts[0] returns the first contact in the list.

Make sure you use valid values as index, otherwise you'll get a runtime error.
For that, use the List.Empty and List.Length runtime properties of the list.
The list should not be empty and index should be between 0 and List.Length -1.

You can find more information about lists in this topic: 

http://www.outsystems.com/help/SErviceStudio/9.0/Language_Reference/Data_Types/List_Data_Type.htm

I hope this helps you.

Kind regards,

jaime
What jaime said. However there are possibly better ways to achieve what you want with outsystems. Afterall, the goal of OS is not having the need of runtime-errors. You can loop through the list and altering it before rendering it to the screen. With a ajax-submit on a row you have the record in the current.
Hi Jaime, J,


Thanks for the reply. My problem is something like this, I have a Table Widget which have a Checkbox and Input widgets in the same row. When the user selects/puts a check mark, I automatically enable it and set the focus to it as well. I have some validations in the OnChange property. What I noticed is that everytime I invoke an Ajax Refresh to the Input Widget to display the validation message, the currentrownumber of the Table changes from 0 to 4.

Thanks.

Regards,

Tupe