[Solved] Macro for random quiz, is that possible?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
DocenteEstresada
Posts: 3
Joined: Sat Sep 30, 2023 11:50 am

[Solved] Macro for random quiz, is that possible?

Post by DocenteEstresada »

Hello and well met, friends.

I'll expose the project I have currently in my hands: As the title suggests, it's about quizs made in a Calc spreadsheet. The blueprint for the quizs in question is already done and it works quite well (is attached below if anyone is curious). The macros I've written for it show/hide certain columns (real answer and the score for each question), apply simple formulas to the area where I want statistics to be shown, and then clears all the data (but not the formulas) to start all over again.

All of this is well and good, but it only works with a fixed set of questions.

My idea was to create a repository of questions (one unit per sheet), from where an hypotetical macro would randomnly pick several (with their correct answers) and place them in the "test" sheet. In that case, please, disregard how the test sheet is currently organized, that can be sorted out later both in the sheet and in the macro code.

I have been searching in this forum and the Spanish one and I've come across solutions that "might" come close to what I want, but to no avail, and my question, before I start fooling around with code (I'm no programmer), is: is this possible in LibreOffice?
Attachments
Test.ods
(41.99 KiB) Downloaded 158 times
Last edited by DocenteEstresada on Sat Sep 30, 2023 10:43 pm, edited 1 time in total.
LibreOffice 7.4.7.2 (x64)

OS: Windows 10 (64bits)
User avatar
MrProgrammer
Moderator
Posts: 4941
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Macro for random quiz, is that possible?

Post by MrProgrammer »

Hi, and welcome to the forum.
DocenteEstresada wrote: Sat Sep 30, 2023 12:47 pm … where an hypotetical macro would randomnly pick several (with their correct answers) …
Perhaps you don't need a macro: [Tutorial] Randomization in Calc

DocenteEstresada wrote: Sat Sep 30, 2023 12:47 pm I'm no programmer.
Only programmers can write macros.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.

[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
DocenteEstresada
Posts: 3
Joined: Sat Sep 30, 2023 11:50 am

Re: Macro for random quiz, is that possible?

Post by DocenteEstresada »

Thank you. I already checked that out a while ago. I'd very much prefer using straight out formulas in the spreadsheet, to be honest, but if I could be able to trigger the whole process at the click of a button.

The point is to have the repositories hidden and under a password, so the pupil would olny see the "test" sheet at all times. At a click from a button, the random questions would appear. I know it can be done in Excel because one of my teachers at Uni used thise method, but I have no idea if this can be translated into LibreOffice, which is what we use at our working place. I will let this sit a few more days, if it's not much of a nuissance, to see what other people might have to say about this.
LibreOffice 7.4.7.2 (x64)

OS: Windows 10 (64bits)
User avatar
Villeroy
Volunteer
Posts: 31288
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro for random quiz, is that possible?

Post by Villeroy »

A database of multiple choice tests:
Attachments
Multiple_Choice.odb
(84.1 KiB) Downloaded 160 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
DocenteEstresada
Posts: 3
Joined: Sat Sep 30, 2023 11:50 am

Re: Macro for random quiz, is that possible?

Post by DocenteEstresada »

I... wow...

Yes, that's why I hit a wall so many times. I just needed to think outside the box! Thank you very much, everyone!
LibreOffice 7.4.7.2 (x64)

OS: Windows 10 (64bits)
Post Reply