Join the Team Forms community

141
members
11
new
J
d
B
R
M

How do I get items with an index greater than 50 from a datasource?

Last updated 3 weeks ago
M
Muffins

I tried to modify the code listed as an example in the datasource settings to put a variable at d[0] to make it dynamic, but it didn't work.

When I checked, it returns up to index 49, but not from index 50 onwards.



The end goal is to get the lookup column id from sharepoint and dynamically reflect it in the child dropdown.

Is it possible to create a code that returns the index or a nearby range that I want?

A
Anthony Phan
Marked as solution

Hi Muffins,

It sounds like you are trying to use the JavaScript functions to dynamically update the data in an excel spreadsheet. Unfortunately, if that is the case, this is currently not supported. Instead, you should adapt the method outlined in the video below which uses Team Forms connection to Microsoft Power Automate to populate the data source when a form is submitted.

The video is cantered around updating a SharePoint list but that same technique can be used with excel or any other type of data source (e.g. SQL, Dynamics or third-party system)





View full solution
A
M
1 comment·3 replies
A
Anthony Phan

Hi Muffins,

It sounds like you are trying to use the JavaScript functions to dynamically update the data in an excel spreadsheet. Unfortunately, if that is the case, this is currently not supported. Instead, you should adapt the method outlined in the video below which uses Team Forms connection to Microsoft Power Automate to populate the data source when a form is submitted.

The video is cantered around updating a SharePoint list but that same technique can be used with excel or any other type of data source (e.g. SQL, Dynamics or third-party system)





M
Muffins

Thank you for your kind response. But it's not what I need.

First of all, what I want to do is not update the datasource. I want to set up two sharepoint data forms and when I select the first one, the second one will be automatically selected. These are just importing tasks.




Here is a sharepoint list that is used as a datasource. It's a list for reserving resources, and it has a lookup column that is fetched from another list, 'Resources'.

What I want to do is that when I select a reservation item from the first data source, the resource reservation list, the resource items from the second data source are automatically selected.



To do this, I make sure that the 'resourceLookupId' value of the resource reservation list matches the resource list index.



To automatically fetch the items with this index, I utilized the example code in the Data source ID window in TeamForms. It seemed pretty straightforward, as I only needed to put a variable in the index value to be fetched.


However, we ran into a problem because the TF_DATASOURCE Promise only returns 50 items by default. I would like to know if there is a javascript code that allows me to retrieve more than 50 items through an additional parameter, or specify a range of indexes to retrieve. This would help me solve many other problems as well.

A
Anthony Phan

O right, my apologies for misinterpreted your original question. There is actually not a limit on the number of records that is returned by TF_DATASOURCE() or tf.getDataSource() . I think its more likely that you have not get more then 50 items in your list (remember the indexes start at 0 not 1)

Your question sounds pretty similar to the question here. You can use the JavaScript array filters to lookup the record your after and set the value of a text field as required.


M
Muffins

Exactly what I needed, thank you.