companion icon indicating copy to clipboard operation
companion copied to clipboard

Read CSV file to variables

Open kcwvc52 opened this issue 2 years ago • 4 comments

Is this a feature relevant to companion itself, and not a module?

  • [X] I believe this to be a feature for companion, not a module

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the feature

I have come across a situation where I need buttons names to update off of a CSV file or excel file. it would be nice for the feedback of the button to access a part of a csv file to update a buttons name/color or whatever else someone else might could use it for.

Usecases

My situation is for using graphics that are being updated from a csv files in a live graphic software. I use buttons in companion to control the software. but when I update the csv files for different events, I have to update the titles on each button manually in companion instead of just pulling from the csv file.

kcwvc52 avatar May 05 '23 13:05 kcwvc52

~~I don't often say no to feature requests, but I don't think this is something that we should do.~~

~~My reasoning is, that doing this kind of import is going to be a very complex to write section of ui, to handle the files having different columns or different column orders, and telling it which buttons to update (which pages to update. which button ranges to update, or which buttons to skip because they are for something else).
And I wonder what good is changing the style without also changing the actions on those buttons. Maybe you don't need to do that, but that feels like a rare case. Modifying properties of actions from a csv file like this will be a nightmare to achieve (actions have a variable amount of properties with different names).~~

But the better question is, why do you need to use a csv file for this? In many modules there are variables exposed which you can use in the button text. Which means it would auto update based on what is loaded into the graphics software. This isnt implemented in every module, and not every device supports this, but I think this would be a much better thing to look into.

Or another option would be to build this into the generic-filereader module, perhaps with the assistance of some internal actions (similar to the json path action we have). If that module could parse a csv file and expose each value as a separate variable, that would likely also solve this as you could place the correct variable on each button. Either replace the file, or change what file it is looking at, and everything would update.

Julusian avatar May 05 '23 23:05 Julusian

It’s been requested multiple times so it obviously something that is useful. I don’t see why it would be so hard to allow the a particular button to receive feedback from an external or imported csv file’s row/column. If that file’s row/column changed the feedback to the name changes. Right now I’m having to completely go through and relabel 40 buttons where my software updates it automatically based on what row/column companion tells it goes to. It doesn’t make sense why companion can’t simply just take the same row/column and let it equal the buttons name. Just simply enabling the feedback to point to a file for naming is all that’s needed. Sent from my iPhone

kcwvc52 avatar May 06 '23 01:05 kcwvc52

OK, so it sounds like this suggestion would work for you

Or another option would be to build this into the generic-filereader module, perhaps with the assistance of some internal actions (similar to the json path action we have). If that module could parse a csv file and expose each value as a separate variable, that would likely also solve this as you could place the correct variable on each button. Either replace the file, or change what file it is looking at, and everything would update.

That makes this much simpler to do

Julusian avatar May 06 '23 11:05 Julusian

You can use the free H2R Graphics program to read a CSV file into its variables. You can then use the H2R Companion calls to refer to the variables and load them into Companion. It works well.

ChrisSW58 avatar Jan 03 '24 16:01 ChrisSW58

The expressions syntax has just gained the ability to do operations on arrays and objects. So I believe this is now possible in the beta builds.

This means you could:

  • Read the csv file (or just a line of it?) using the generic-filereader module
  • Use an expression like split($(internal:custom_my_csv_var), ',')[0] somewhere that accepts expressions to extract the first value from that line.
    • This might require manually splitting this out into more variables if you need to feed it into actions which cant accept expressions. This is perhaps a bit tedious, but will have to do for now

Julusian avatar Feb 25 '24 19:02 Julusian

with the h2r variables it only allows the highlighted item in the list to be used as a label. i need every row use as a label which would require me to make 20 list. unless im missing something?

On Sun, Feb 25, 2024 at 1:29 PM Julian Waller @.***> wrote:

The expressions syntax has just gained the ability to do operations on arrays and objects. So I believe this is now possible in the beta builds.

This means you could:

  • Read the csv file (or just a line of it?) using the generic-filereader module
  • Use an expression like split($(internal:custom_my_csv_var), ',')[0] somewhere that accepts expressions to extract the first value from that line.
    • This might require manually splitting this out into more variables if you need to feed it into actions which cant accept expressions. This is perhaps a bit tedious, but will have to do for now

— Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion/issues/2437#issuecomment-1963037488, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBWKVV7KJW2CEDCHCMFYS3YVOGLNAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGAZTONBYHA . You are receiving this because you authored the thread.Message ID: @.***>

kcwvc52 avatar Mar 12 '24 15:03 kcwvc52

with the h2r variables it only allows the highlighted item in the list to be used as a label. i need every row use as a label which would require me to make 20 list. unless im missing something? On Sun, Feb 25, 2024 at 1:29 PM Julian Waller @.> wrote: The expressions syntax has just gained the ability to do operations on arrays and objects. So I believe this is now possible in the beta builds. This means you could: - Read the csv file (or just a line of it?) using the generic-filereader module - Use an expression like split($(internal:custom_my_csv_var), ',')[0] somewhere that accepts expressions to extract the first value from that line. - This might require manually splitting this out into more variables if you need to feed it into actions which cant accept expressions. This is perhaps a bit tedious, but will have to do for now — Reply to this email directly, view it on GitHub <#2437 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBWKVV7KJW2CEDCHCMFYS3YVOGLNAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGAZTONBYHA . You are receiving this because you authored the thread.Message ID: @.>

No - H2R can store variables in a 3 column array, which can be loaded from a CSV file - 3 columns with multiple arrays. You can access each row and from that the contents of each column and store the data in that cell in Companion in a variable, from which you can use in buttons or to make choices.

ChrisSW58 avatar Mar 12 '24 19:03 ChrisSW58

This may be possible but would still be quicker to type the words in one by one. Because the variables associated with h2r go row by row when trying to grab the information. $(H2R_Graphics:list1.1) this only grabs 1 row of data. I need to be able to change the row with the variable to actually save time. We are having to change the buttons daily with our productions and currently we are having to manually update them. This takes about an hour every time. This option seems just as slow as updating them manually.

On Mar 12, 2024, at 2:23 PM, ChrisSW58 @.***> wrote:



with the h2r variables it only allows the highlighted item in the list to be used as a label. i need every row use as a label which would require me to make 20 list. unless im missing something? … <#m_8549672368231036626_> On Sun, Feb 25, 2024 at 1:29 PM Julian Waller @.*> wrote: The expressions syntax has just gained the ability to do operations on arrays and objects. So I believe this is now possible in the beta builds. This means you could:

No - H2R can store variables in a 3 column array, which can be loaded from a CSV file - 3 columns with multiple arrays. You can access each row and from that the contents of each column and store the data in that cell in Companion in a variable, from which you can use in buttons or to make choices.

— Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion/issues/2437#issuecomment-1992378118, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBWKVUAOVDI33WTTAJESETYX5I2LAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJSGM3TQMJRHA . You are receiving this because you authored the thread.Message ID: @.***>

kcwvc52 avatar Mar 12 '24 20:03 kcwvc52

I load up 70 rows of data from a CSV file and use the 210 cells from the CSV file in companion as variables as required. Editing the CSV file takes just a few minutes. It suits me but may not be what you are looking for.  Good luck.Kind regards,ChrisSent from my iPhoneApologies for brevity & Apple's spelling!On 12 Mar 2024, at 8:54 PM, kcwvc52 @.***> wrote: This may be possible but would still be quicker to type the words in one by

one. Because the variables associated with h2r go row by row when trying to

grab the information. $(H2R_Graphics:list1.1) this only grabs 1 row of

data. I need to be able to change the row with the variable to actually

save time. We are having to change the buttons daily with our productions

and currently we are having to manually update them. This takes about an

hour every time. This option seems just as slow as updating them manually.

On Mar 12, 2024, at 2:23 PM, ChrisSW58 @.***> wrote:



with the h2r variables it only allows the highlighted item in the list to

be used as a label. i need every row use as a label which would require me

to make 20 list. unless im missing something?

… <#m_8549672368231036626_>

On Sun, Feb 25, 2024 at 1:29 PM Julian Waller @.*> wrote: The expressions

syntax has just gained the ability to do operations on arrays and objects.

So I believe this is now possible in the beta builds. This means you could:

  • Read the csv file (or just a line of it?) using the generic-filereader

module - Use an expression like split($(internal:custom_my_csv_var),

',')[0] somewhere that accepts expressions to extract the first value from

that line. - This might require manually splitting this out into more

variables if you need to feed it into actions which cant accept

expressions. This is perhaps a bit tedious, but will have to do for now —

Reply to this email directly, view it on GitHub <#2437 (comment)

https://github.com/bitfocus/companion/issues/2437#issuecomment-1963037488>,

or unsubscribe

https://github.com/notifications/unsubscribe-auth/ALBWKVV7KJW2CEDCHCMFYS3YVOGLNAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGAZTONBYHA

https://github.com/notifications/unsubscribe-auth/ALBWKVV7KJW2CEDCHCMFYS3YVOGLNAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGAZTONBYHA

. You are receiving this because you authored the thread.Message ID: @.*>

No - H2R can store variables in a 3 column array, which can be loaded from

a CSV file - 3 columns with multiple arrays. You can access each row and

from that the contents of each column and store the data in that cell in

Companion in a variable, from which you can use in buttons or to make

choices.

Reply to this email directly, view it on GitHub

https://github.com/bitfocus/companion/issues/2437#issuecomment-1992378118,

or unsubscribe

https://github.com/notifications/unsubscribe-auth/ALBWKVUAOVDI33WTTAJESETYX5I2LAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJSGM3TQMJRHA

.

You are receiving this because you authored the thread.Message ID:

@.***>

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

ChrisSW58 avatar Mar 12 '24 21:03 ChrisSW58

I have the latest version of companion and I have no options to use rows. Only to change them. It sounds like it’s possible. Regardless this is a ridiculous process to do something simple. Sent from my iPhoneOn Mar 12, 2024, at 4:25 PM, ChrisSW58 @.> wrote: I load up 70 rows of data from a CSV file and use the 210 cells from the CSV file in companion as variables as required. Editing the CSV file takes just a few minutes. It suits me but may not be what you are looking for.  Good luck.Kind regards,ChrisSent from my iPhoneApologies for brevity & Apple's spelling!On 12 Mar 2024, at 8:54 PM, kcwvc52 @.> wrote:

This may be possible but would still be quicker to type the words in one by

one. Because the variables associated with h2r go row by row when trying to

grab the information. $(H2R_Graphics:list1.1) this only grabs 1 row of

data. I need to be able to change the row with the variable to actually

save time. We are having to change the buttons daily with our productions

and currently we are having to manually update them. This takes about an

hour every time. This option seems just as slow as updating them manually.

On Mar 12, 2024, at 2:23 PM, ChrisSW58 @.***> wrote:



with the h2r variables it only allows the highlighted item in the list to

be used as a label. i need every row use as a label which would require me

to make 20 list. unless im missing something?

… <#m_8549672368231036626_>

On Sun, Feb 25, 2024 at 1:29 PM Julian Waller @.*> wrote: The expressions

syntax has just gained the ability to do operations on arrays and objects.

So I believe this is now possible in the beta builds. This means you could:

  • Read the csv file (or just a line of it?) using the generic-filereader

module - Use an expression like split($(internal:custom_my_csv_var),

',')[0] somewhere that accepts expressions to extract the first value from

that line. - This might require manually splitting this out into more

variables if you need to feed it into actions which cant accept

expressions. This is perhaps a bit tedious, but will have to do for now —

Reply to this email directly, view it on GitHub <#2437 (comment)

https://github.com/bitfocus/companion/issues/2437#issuecomment-1963037488>,

or unsubscribe

https://github.com/notifications/unsubscribe-auth/ALBWKVV7KJW2CEDCHCMFYS3YVOGLNAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGAZTONBYHA

https://github.com/notifications/unsubscribe-auth/ALBWKVV7KJW2CEDCHCMFYS3YVOGLNAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGAZTONBYHA

. You are receiving this because you authored the thread.Message ID: @.*>

No - H2R can store variables in a 3 column array, which can be loaded from

a CSV file - 3 columns with multiple arrays. You can access each row and

from that the contents of each column and store the data in that cell in

Companion in a variable, from which you can use in buttons or to make

choices.

Reply to this email directly, view it on GitHub

https://github.com/bitfocus/companion/issues/2437#issuecomment-1992378118,

or unsubscribe

https://github.com/notifications/unsubscribe-auth/ALBWKVUAOVDI33WTTAJESETYX5I2LAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJSGM3TQMJRHA

.

You are receiving this because you authored the thread.Message ID:

@.***>

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

kcwvc52 avatar Mar 12 '24 22:03 kcwvc52

H2R-Graphics: Variable List - Select row internal: Custom Variable: Store variable value, where the from is: list1.1 (H2R-Graphics:list1.1) list1.2 (H2R-Graphics:list1.2) or list1.3 (H2R-Graphics:list1.3)

Kind regards,

Chris

On 12 Mar 2024, at 10:10 PM, kcwvc52 @.***> wrote:

I have the latest version of companion and I have no options to use rows. Only to change them. It sounds like it’s possible. Regardless this is a ridiculous process to do something simple. Sent from my iPhoneOn Mar 12, 2024, at 4:25 PM, ChrisSW58 @.> wrote: I load up 70 rows of data from a CSV file and use the 210 cells from the CSV file in companion as variables as required. Editing the CSV file takes just a few minutes. It suits me but may not be what you are looking for. Good luck.Kind regards,ChrisSent from my iPhoneApologies for brevity & Apple's spelling!On 12 Mar 2024, at 8:54 PM, kcwvc52 @.> wrote:

This may be possible but would still be quicker to type the words in one by

one. Because the variables associated with h2r go row by row when trying to

grab the information. $(H2R_Graphics:list1.1) this only grabs 1 row of

data. I need to be able to change the row with the variable to actually

save time. We are having to change the buttons daily with our productions

and currently we are having to manually update them. This takes about an

hour every time. This option seems just as slow as updating them manually.

On Mar 12, 2024, at 2:23 PM, ChrisSW58 @.***> wrote:



with the h2r variables it only allows the highlighted item in the list to

be used as a label. i need every row use as a label which would require me

to make 20 list. unless im missing something?

… <#m_8549672368231036626_>

On Sun, Feb 25, 2024 at 1:29 PM Julian Waller @.*> wrote: The expressions

syntax has just gained the ability to do operations on arrays and objects.

So I believe this is now possible in the beta builds. This means you could:

  • Read the csv file (or just a line of it?) using the generic-filereader

module - Use an expression like split($(internal:custom_my_csv_var),

',')[0] somewhere that accepts expressions to extract the first value from

that line. - This might require manually splitting this out into more

variables if you need to feed it into actions which cant accept

expressions. This is perhaps a bit tedious, but will have to do for now —

Reply to this email directly, view it on GitHub <#2437 (comment)

https://github.com/bitfocus/companion/issues/2437#issuecomment-1963037488>,

or unsubscribe

https://github.com/notifications/unsubscribe-auth/ALBWKVV7KJW2CEDCHCMFYS3YVOGLNAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGAZTONBYHA

https://github.com/notifications/unsubscribe-auth/ALBWKVV7KJW2CEDCHCMFYS3YVOGLNAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRTGAZTONBYHA

. You are receiving this because you authored the thread.Message ID: @.*>

No - H2R can store variables in a 3 column array, which can be loaded from

a CSV file - 3 columns with multiple arrays. You can access each row and

from that the contents of each column and store the data in that cell in

Companion in a variable, from which you can use in buttons or to make

choices.

Reply to this email directly, view it on GitHub

https://github.com/bitfocus/companion/issues/2437#issuecomment-1992378118,

or unsubscribe

https://github.com/notifications/unsubscribe-auth/ALBWKVUAOVDI33WTTAJESETYX5I2LAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJSGM3TQMJRHA

.

You are receiving this because you authored the thread.Message ID:

@.***>

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***> — Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion/issues/2437#issuecomment-1992667426, or unsubscribe https://github.com/notifications/unsubscribe-auth/BA2KHP2WIBORNGVRVBDUVO3YX54NFAVCNFSM6AAAAAAXXDTPX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJSGY3DONBSGY. You are receiving this because you commented.

ChrisSW58 avatar Mar 12 '24 22:03 ChrisSW58