Seperate First name from AICC_STUDENT_NAME

Hey everyone,


Haven't been on here in a while. I know I have seen notes n this before but I can't find it.


I am trying display the students first name but the AICC_Student_Name only pulls LastName, FirstName.


Is there a way with variables to strip off the LastName, and only display the firstname?


I can probably manage this if I use a flash file to read the AICC_Student_name variable, strip out what I don't need, write the first name to a new variable, and then use Lectora read the variable.


Since I do plan on doing some development for an LMS that uses iPads, I was trying to avoid the flash route though.


Anyone ever manage this?

Discussion (43)

Do you need to pull the name from AIC_Student_Name? What about having the first name be its own variable and then asking them for their name at the start of the course?


I think how you plan to have the first name show in the course depends on what you are doing with it. If it is just for customization (e.g., a guide says something like "Hi FIRSTNAME, let's learn do something!") then a new variable would work well for that.

Haven't tried it yet, but using javascript and the split() method.


It should look something like this (variables aren't correct, just used as an example):


var studentname = varaicc_studnet_name.split(",");

var firstname = studentname[1];

[/CODE]

the variable "firstname" should then only hold the students first name for you to use anywhere

hopefully this gives you a starting place, let me know if you have any trouble with it! (someone else on here might be able to give you a better answer too)[CODE]

var studentname = varaicc_studnet_name.split(",");

var firstname = studentname[1];

[/CODE]


the variable "firstname" should then only hold the students first name for you to use anywhere


hopefully this gives you a starting place, let me know if you have any trouble with it! (someone else on here might be able to give you a better answer too)

It can be done in three steps:


1.

Create a textfield that's initially invisible

Add an action

On: Page show

Action: Change content

Target: This object

Value: VAR(AICC_Student_Name)


2.

Create two variables

-> lastname

-> firstname


3.

Add an action on page level


On: Show

Action: Run JavaScript

Javascript:

var username = VarAICC_Student_Name.getValue().split(", ");

Varlastname.set(username[0]);

Varfirstname.set(username[1]);


"lastname" now contains the users' lastname (i.e. everything before the ", ") "firstname" contains the users' firstname. Both variables can now be used throughout the course.


Tim

Thanks, Tim! I was about 1/3 of the way there lol :)

Thanks. This worked great.

Hey Tim, thx :-)

i tried it but its the same like before, is there maybe something false in my variablemanager...

variablenmanager.jpg

Hey guys, i need really help, i did exactly the three steps from Tim, but it doesnt work. Has anyone an idea? i have Lectora inspire 17.0.2. The strange thing is, that in Lectora online, the first name appears at beginning but in inspire it doesnt work.

var username = AICC_Student_Name.getValue().split(",",2);

Varlastname.set(username[0]);

Varfirstname.set(username[1]);

alert(username);

greetings marcel

If you publish with "Publish for Seamless Play" the code needs to be changed:

var username = parent.AICC_Student_Name.getValue().split(undefined

parent.Varlastname.set(username[0]);

parent.Varfirstname.set(username[1]);

Tim

sorry it is the first time i work with variables :-)

undefined

Ok, here's my title, I tested in moodle 3.0.

Damit sollte es funktionieren.

Tim

second try: i get always both names

Wellcome Eastwood, Clint

for my project it will be necessary that only the firstname will appear....

For example: Wellcome Clint

i have send you a test title, maybe it helps

oh no it didnt work...:-( isnt allowed to send project files

hey Tim, vielen Dank, werde es gleich ausprobieren.

glg Marcel

undefined

Hey Tim, super, danke dir :-) ist es aber auch möglich nur den Vornamen anzeigen zu lassen, quasi...."Hi Marcel"....das wäre nämlich genial :-)

variable.jpg

Hi Marcel,

I'll return to English as the community is international.

The whole sense of the script is to have both parts of the name in two separate variables. The message displays

"Hi VAR(firstname) VAR(lastname)" If you remove the part about the lastname, it'll show "Hi Marcel".

There's a German group http://community.trivantis.com/groups/lectora-user-im-deutschsprachigen-raum/forum/

Tim

Hm, did you change anything else? "0" is the initial value of the variable, so the "Display Message" action is working alright. Seems more like the script isn't setting the name. You didn't remove the action to "Modify variable" "username" did you? Did you test in your LMS? Did you uncheck "Publish for Seamless Play" when publishing to Scorm? (Sorry, actually I don't know what it's called in German) These are the three reasons I can think of causing the script to not get the name.

Here's another sample, I tested in moodle (now 3.1.5). The textfield displays the firstname only, the message still displays both parts.

Tim

and you can see i removed the (Var)lastname.

variable_firstname2.jpg

Hi Tim, thx for your help, i tried it and have again the strange result but with both variables it works.

"hi 0" is now the message

undefined

variable_firstname.jpg

Hey Tim, thx, this works, a little bit strange, maybe i forgot something, i had a lot to do the last days but tomorrow i will work further on my little project :-) i had last week another little problem, when i pasted a textfield with some text, i had another format result. That means, that the textformat in the editor view is not the same like in the Preview mode. Do you have an idea why? For me its very bad, because i have to place exactly symbols beside terms in my text

nice greetings, Marcel

The browsers sometimes interpret Lectoras style settings differently. What exactly is different? Position of the textfield? Or formatting of the text itself?

Not only will things look different in preview versus editor mode, but even when you publish it might look different in different browsers. Just try and publish, then test in IE, FF, Chrome and Edge ( and if you dare even Safari ). If the look and feel of your texts and formatting is everywhere exact the same, you are very lucky. In most cases there will be differences, and if you need to get them all 100% the same, your in for quite some work. Back to the issue at hand, the difference in preview versus editor mode. I do think you should ignore both. What counts is your final output, being HTML. So publish and test that.... thats what the endresult will be. Preview in browser targetting your favourite browser for me often gives the closest result compared to a publish.

~Math

Hi Tim,

thx for your fast answer, yes the formatting of the text itself is different.

you can see it in the two pictures....really strange

editor.jpg

You'll get better results if you just split your text into separate text boxes.

Although it won't look exactly the same in different browsers, the difference in line-height seems to be bigger than what was to be expected. Where did you copy the text from? If you copy directly from MS Word, it may include styling from Word. Try to paste the text again unformatted by selecting all, [Ctrl] + [x], [Ctrl] + [Shift] + [v].

and this is how it looks like in the preview mode...

preview-1.jpg

Hey Tim, thx this works :-) nice greetings Marcel

Heyyyyy Tim, thanks this works! you are great man :-) Now i am looking for some funny questions....thx!!!

nice greetings, Marcel

Hi Marcel, first thing you might wanna check out is whether the Variable for the score is referring to the proper Quiz/Assesment. When copying /pasting or changing in Lectora those can refer to a non-existing quiz because you might renamed it.

Another possible issue might be Flash. Is that Template using Flash ?

undefined

~Math

I've added the row score variables to contain the respective values 100, 300,...

I wouldn't advise learning from this template, it's difficult to edit as they seem to have tried avoiding Question objects and I have no idea why...

Still the score now seems to be working.

Will check it later today. Please make separate posts for new things like this Marcel, makes it easier when you tag it properly for other users to find and fix issues they encounter that are alike yours...

and this is the project file :-) i would be very happy if anyone can solve the score problem.

..and by the way: you can add more than one attachment to a post, so there's no need to create a separate post for each image or zip ;-)

As Tim said, its a real buggy template. Indeed they add value to an non-existing variable and thus the endresults shows -> 0Var(A)Var(B) etc... but thats not all. Also naming of all elements is confusing. Multiple objects in the template have the same names ( for example textfield Score is in there a lot of times ) Not giving unique names to your pageelements makes it troublesome to see if you are targeting the correct element with an action. The same applies to actions... all default names inthere... making it tough to see in 1 view whats what.

In my opinion...make a habit out of naming each element properly. Pageelements, actions and groups. Make sure they all have a proper descriptive name, so you can see in 1 view whats what.

Just adding those missing variables aint enough to get it working though. Might dive a bit more into it, but as said the template really is a mess.

~Math

A man walks into a psychiatrists office with a steering wheel sticking in his breast. What's happening?

Now it makes really fun with lectora :-) but there a lot of things which i dont unterstand.

yesterday i looked at the templates from the elearning brothers.... i found a really cool quiz, i tested it in our LMS but the Score module didnt worked right. Do you have an idea why? Sorry for my questions but it seems you are really ingenious in Lectora. :-)

quiz.jpg

The template is buggy... In each action group of each question, e.g. "actionGrpQ01_correct" there is an action called "Add_GameScore". The action adds VAR(eLB_Points_Row1) to VAR(eLB_GameScore). The variable "eLB_Points_Row1" does not exist so Lectora just adds the text. It seems they wanted to create a separate score for the different rows of the Gameboard and add the row scores to the total score, but forgot to create the variables and a logic to calculate a row score.

hey math, thx, ok for me its a little bit too much variables :-) where can i check this in the variablemanager

no, the template dont uses flash...hmm

greetings marcel

quiz2.jpg

these are the the facts about the template

quiz3.jpg

hi Tim, thx for your post, ok so what can i do that i can use it right, i wanted to make a small quiz for our LMS and i thought, that this template helps to save time :-) the idea was a fun-quiz :-)

greetings Marcel

Hey Math, thanks :-) this would be very fine :-) yes, sorry my next problem (and it will come certainly) gets a new tread.

greetings Marcel

hahahaha give me a lead :-)

A. It hurts

B. Doesn't know how he got it

C. Drives him crazy

Discussions have been disabled for this post