Flash cards

0
Hi I’m Jasmine Looking for ideas for custom logic for study flash cards. I built a language studying app. I want to add flash cards that can be: -drawn randomly -drawn from entire database or filtered by word category(attribute) I.e. study only verbs  -one side  is English values, flip side is corresponding values in other language. I built each word as an object and languages are attributes.    thank you!
asked
2 answers
0

A few pieces of the puzzle:

You could create a microflow that retrieves the n-th item from a list of cards.

Retrieve a list of card from that database, eg of one category and then then use random() to generate a random number and select the card with that number from the retrieved list.

https://docs.mendix.com/refguide/mathematical-function-calls#5-random

Good luck with the app!

answered
0

Hi Jasmine,

  1. I would probably write a java program
    • get the list of Word (objects)
    • You can use int rand_int2 = rand.nextInt(1000); to get a random integer with 0-1000
    • In place of 1000, you can pass the count or size of list to ensure you are getting a random integer for the size of words you have, which makes it a dynamic approach. So it is like int rand_int2 = rand.nextInt(<size or length of list>);
    • Then you can use this integer as index and retrieve the Word from the index, which is easy in Java https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#get(int)
    • This way you could ensure you get a random Word
    • You can also make sure to drawn from database or filter with category by passing the category to java and use XPATH https://docs.mendix.com/refguide/xpath
  2. The mathematical function random returns a random number >= 0.0 and < 1.0. Not sure if it is really sufficient, I must first try that to confirm. 

 

answered