G Gekornro Member Licensed User Longtime User Sep 13, 2012 #1 Hi, I have a table created in Excel and I would like to use the data in my App. The table looks something like this: (my app has nothing to do with fruits...but it's easier to explain it by making it simple) Code: Copy CATEGORY TYPE COLOUR Fruit Apple Green Fruit Banana Yellow Fruit Orange Orange Vegetable Tomato Red Vegetable Cauliflower White Meat Beef Steak Red Meat Chicken Pink In my app I would like to ask questions. The question is randomly created and will look like this: APPLE is a FRUIT. What COLOUR is it? The answers are multiple choice where the replies are randomly generated from the Colour column (two wrong, one right answer). I could very easily create this in Excel/visual basic but how would I go about it in B4A? I'm not a database wizard. Can I get this done without using database? I.e. load the table into B4A and use commands to generate the questions? I'm not going to write anything to the table. It will be read only. I haven't even started this app yet so I have no code to show. As I said, I've never dealt with tables before. My apps so far have been a bit simpler and the data has been so limited that I could just store them as values in the code. This time around I will have hundreds of rows of data so I need a better solution...ideally not involving SQL since I quite suck at it... Last edited: Sep 13, 2012
Hi, I have a table created in Excel and I would like to use the data in my App. The table looks something like this: (my app has nothing to do with fruits...but it's easier to explain it by making it simple) Code: Copy CATEGORY TYPE COLOUR Fruit Apple Green Fruit Banana Yellow Fruit Orange Orange Vegetable Tomato Red Vegetable Cauliflower White Meat Beef Steak Red Meat Chicken Pink In my app I would like to ask questions. The question is randomly created and will look like this: APPLE is a FRUIT. What COLOUR is it? The answers are multiple choice where the replies are randomly generated from the Colour column (two wrong, one right answer). I could very easily create this in Excel/visual basic but how would I go about it in B4A? I'm not a database wizard. Can I get this done without using database? I.e. load the table into B4A and use commands to generate the questions? I'm not going to write anything to the table. It will be read only. I haven't even started this app yet so I have no code to show. As I said, I've never dealt with tables before. My apps so far have been a bit simpler and the data has been so limited that I could just store them as values in the code. This time around I will have hundreds of rows of data so I need a better solution...ideally not involving SQL since I quite suck at it...
Erel B4X founder Staff member Licensed User Longtime User Sep 13, 2012 #2 You can load CSV files with StringUtils library. You can create a custom type that holds the three values for each item. Make a list for these items and then randomly pick one. Upvote 0
You can load CSV files with StringUtils library. You can create a custom type that holds the three values for each item. Make a list for these items and then randomly pick one.