vMix Forums
»
General
»
3rd Party Software and Development
»
syntax for API call for "DataSourceSelectRow!
Rank: Advanced Member
Groups: Registered
Joined: 11/22/2018(UTC) Posts: 94 Location: Worthing Thanks: 1 times Was thanked: 4 time(s) in 3 post(s)
|
Hi,
This forum has been very helpful to me and so I am scrounging again for advice.
I am trying to script a loop of data from a spreadsheet but I need work out what the syntax in a VB.NET script is for DataSourceSelectRow I understand that I need to name the datasource and the sheet and the row I want to show but I can't work out the syntax. I have tried the following below: api.Function("DataSourceSelectRow",Input:= "Excel Workbook", "Sheet1", value:=x) How far am I away from the correct syntax
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,243 Location: Belgium Thanks: 294 times Was thanked: 960 time(s) in 794 post(s)
|
There should not be an input reference and the value is the table, sheet , index
if its not an excel you can omit the sheet part
Think its something like API.Function("DataSourceSelectRow",Value:="DataTableName,Sheet,Index")
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 11/22/2018(UTC) Posts: 94 Location: Worthing Thanks: 1 times Was thanked: 4 time(s) in 3 post(s)
|
Thanks but that didn't work it saved without error but it didn't change the row on the selected DataSource
The DataSource in this instance is a Excel Workbook and it is Sheet2 I have tried the following API.Function("DataSourceSelectRow",Value:="TableName,Sheet,1") API.Function("DataSourceSelectRow",Value:="TableName,Sheet, index:=1") both have saved but neither selects Row 1 on the sheet on the specified Workbook?
by the way if I save it as a Webscript this works and selects row 1 Function=DataSourceSelectRow&Value=TableName,Sheet,0
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,243 Location: Belgium Thanks: 294 times Was thanked: 960 time(s) in 794 post(s)
|
eliminate the index:= just use the index value
API.Function("DataSourceSelectRow",Value:="Excel Workbook,Sheet2,1")
Personally i prefer to name the data source table more simple (one word)
btw row 1 is index 0 ;-)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 11/22/2018(UTC) Posts: 94 Location: Worthing Thanks: 1 times Was thanked: 4 time(s) in 3 post(s)
|
Yes that worked, is there a way to change the row to a variable inside a loop.
I tried a loop 1 to 5 but couldn't get it to change row based on the value of x (I get the part about Row 1 being index 0 :-)
dim x as integer Dim Index as integer =0 'API.Function("PreviewInput",Input:="race1.mp4") Do while Index <=100 for x = 1 to 5 api.Function("DataSourceSelectRow",Value:="Excel Workbook,Sheet,x") sleep(10000) next x index +=1 loop
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,243 Location: Belgium Thanks: 294 times Was thanked: 960 time(s) in 794 post(s)
|
you can also use DataSourceSelectRow once you have set it to your first row
else it's something like api.Function("DataSourceSelectRow",Value:="Excel Workbook,Sheet," & x.tostring)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 11/22/2018(UTC) Posts: 94 Location: Worthing Thanks: 1 times Was thanked: 4 time(s) in 3 post(s)
|
Thanks I didn't know how to integrate the string.
I will pop this into the script for dummies forum along with all the others you have solved.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/15/2022(UTC) Posts: 7 Location: Manila Thanks: 2 times
|
Originally Posted by: doggy you can also use DataSourceSelectRow once you have set it to your first row
else it's something like api.Function("DataSourceSelectRow",Value:="Excel Workbook,Sheet," & x.tostring) Hi doggy, Is there a way to: 1. Get and Print the index of the current selected record in datasource and use it to select the next record. 2. If current position is the last record, select the 1st record in datasource. 3. no looping. Thanks in advance!
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,243 Location: Belgium Thanks: 294 times Was thanked: 960 time(s) in 794 post(s)
|
Originally Posted by: lance_05
Hi doggy,
Is there a way to:
1. Get and Print the index of the current selected record in datasource and use it to select the next record.
No ( unless you keep track of it somehow ) . remember there is a function to jump to the next row already! Quote:2. If current position is the last record, select the 1st record in datasource. with a script when you do a next row one can check if the "previous" content is the same as the "next" indicating its in fact the same row = last row ( works only if each row is unique in data) and instruct to jump to first row You just asked for a loop in point 2 ? Alternatively one can have an external app reading your data source and program in anything you want to do with it including knowing the row number . How it was done before data sources were introduced and scripting
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/15/2022(UTC) Posts: 7 Location: Manila Thanks: 2 times
|
As usual, Thanks a lot for the helpful response doggy.
Actually my question mainly depends on getting that index variable so it can be used with the selectrow function. (like using a single shortcut key to rundown all records in each press, instead of 1 key each to select either next/previous record which I already have). By the way, nice workaround on my 2nd question.
You see, I wanted to experiment more using datasource and also learn scripting to further automate my setup. (Been using most of your responses as reference actually)
But since there's no way to get index easily within vmix, I agree that looping is needed.
Thanks again!
|
|
|
|
vMix Forums
»
General
»
3rd Party Software and Development
»
syntax for API call for "DataSourceSelectRow!
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close