Group Abstract Group Abstract

Message Boards Message Boards

1
|
11.5K Views
|
5 Replies
|
7 Total Likes
View groups...
Share
Share this post:

How can I create a data import button for Player Pro?

Posted 12 years ago

Hi everyone,

Can't seem to create a button for importing data from external files that could be used by those opening a notebook with Player Pro. I tried the example at the bottom of

http://www.wolfram.com/player-pro/developer-guidelines.html

by doing this

Manipulate[
 data = Import[dataFilePath, "CSV"],
 Button["Load data...", dataFilePath = SystemDialogInput["FileOpen"]]
 ]

but I get Failed or Canceled. Seems as though the file path is not saved to dataFilePath. What am I doing wrong?

Gregory

POSTED BY: Gregory Lypny
5 Replies
POSTED BY: David Reiss

Hello Yvan,

I think the issue is that you need to store the result of the import into a variable that is shown somewhere else and wrapped inside a Dynamic[]. For example:

DynamicModule[{result = "please load file"},
 {Dynamic[result],
  Button["Click Here", result = Import[SystemDialogInput["FileOpen"]],
    Method -> "Queued"]}]
POSTED BY: Gustavo Delfino
Posted 4 years ago

.... seems not to work anymore ...

I would just open a file (picture) with a button, but I don't understand why my code doesn't work ...

Button["Click Here",
 Import[SystemDialogInput["FileOpen"]],
 Method -> "Queued"
 ]

Thanks for an help ...

Yvan

POSTED BY: Yvan Abbe
Posted 4 years ago
POSTED BY: Yvan Abbe
Posted 12 years ago

Hi David,

Works like a charm. Thank you for the crystal-clear explanation. I'll do my homework on Catch and Throw as I haven't had occasion to use them before.

Thanks again,

Gregory

POSTED BY: Gregory Lypny
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard