Movie Review app questions about votes & stars

Hi,

I’m learning AppGyver by following the tutorials – Now I’m watching the Moview Review App tutorial and doing it myself, but I got stuck in creating stars for user votes:

  1. When repeating a star icon the following MAP function is used:

MAP( REPEAT({}, 5), {index: index + 1})

For the transformation formula part, I think it should be

{“index”: index + 1}

because the first “index” is the variable name (which will be used as current.index) and the second “index” is the context variable for the MAP function. Why does the tutorial use the above and everything looks fine?

    1. When displaying a star icon, the following conditional statement is used:

IF(current.index <= pageVars.reviewStarCount, “star”, “star-o”)

Where can I find the texts such as “star” and “star-o”, which look like normal text, but they are actually representing icons?

For the first question, when inserting object keys, it’s not using variable references, if you’d want a variable reference ( not sure if our editor blocks it but e.g. in javascript) you would have to write { [index]: index + 1}.

For the second question, if you open the icon selection modal you can hover over a desired icon and it will preview its’ name. Not the best workflow, we should probably add a list of included icons to the documentation. Anyway we are using fontawesome icons so you can find lots of lists of the names in the internet, just not every icon is included in our platform.

image
image

I got it! Thank you so much.

May I ask one more question?

In the last part of the tutorial, the formula below is used to find the correct record which matches the ID value:

LOOKUP( PICK_ITEM(data.MovieReview, 0), “id”)

As a parameter to the LOOKUP() function, can I use simply data.MovieReview[0] instead of PICK_ITEM to pick up the first element in the record collection?

You should be able to use [0]

Any difference between using PICK_ITEM and [0] operator?

PICK_ITEM does some variable type checking before invoking [x] operation. So for example:

PICK_ITEM("wat am i doing", 0) => null
"wat am i doing"[0] => "w"

Oh that’s great! Thank you so much for explanation!