Saving instance of variable in table record other than CurrDate()
Question
Application Type
Reactive
Service Studio Version
11.11.8 (Build 45664)

I am relatively new to outsystems, and have been learning along the way with tutorials and forums.  I have gone through the whole reactive development course with outsystems, and I still do not understand how to do this.  I have only basic coding knowledge (css/html/java) but I figured there should be a way to do this in a low code environment.


I am trying to make an online test with a score that gets recorded to a table, and could later be referenced in an email or exported to excel.  I have done several Form  Submission tutorials, and have been able to successfully create entities that populate with data from forum input fields (First Name, Last Name, CurrDateTime(), SCORE (cannot get this to record).  

The problem is that the user text input such as first name gets recorded in the entity, and so does date/time, but I cannot get my variable to record in the column I designated for it (variable = Client.Total).

Client. Total is derived from a score based on questions from radio buttons with specific values.  

I have tried to set the field value as Integer, Record, and Client.Total, but none of this works.  I just want to be able to record an instance of the variable automatically when the person presses "submit" with their first and last name typed into input fields.  The variable also changes and resets with page refresh, so that's why I said "an instance" of the variable.


Any help would be appreciated.  I cannot find this anywhere in video tutorials or forums.


Here is a practice file I tried various ways to make the input variable Client.Total.  


I thought I made progress when I made a calculated attribute output column where I could input in the formula Client.Total.  This only changed all the scores in the column for all of the entries, and also did not record to table with actions.  It only recorded the default integer value 0.

ExportData.oap

Hi Lukasz,


I have difficulties to understand your problem. I have been playing a little bit with your code, and I can see Client.Total being incremented when I click "Add":

To go further it would be great if you could use the same names between the description of your problem and the buttons/entities/actions we see in the code. No need to pay attention to details like "instance of a variable", just try to describe what you want to do and we'll try to make it happen ;)

Another major issue I faced is that I can't access the definition of your fetch Data "GetBecks":

Was everything correct when you created your oap?


Attaching my oap if it can help

ExportData.oap

Good morning Lukasz,


Are you still facing the same problem?

HI,

Sorry but that did not resolve my problem.  This file that I uploaded was just a scratch project I made to test various ways I tried to do exactly what I was trying but I could not find any tutorials on it.  

I will try again to explain what I'm trying to do.  I'm trying to find a tutorial or documentation that can show me step by step how to save a variable into a database.

In the attached image, I want there to be a local variable that saves into the column that's labeled "Score" every time the form is submitted.

Basically I want to create a form with 3 input fields at the bottom of a multiple choice test that records the test score into a table. So it would be multiple choice radio button questions that all add up to some value "Client.Total"  Then, at the bottom of the page, there would be an input field for First Name, input for Last name, and a submit button.

When the person types their name in and presses Submit, I want their first name, last name, and whatever the total score is (value of Client.Total) to be recorded in the table:

First:        |  Last:        |  Score (Client.Total):

John          |    Doe      |   20

Jane           |  Doe        |  24

John          |   Smith     |   10


What I can't figure out is how to store the value of Client.Total into that same record that has the person's first and last name in a seperate column.

I just would like a simple step of how to get a submit button to record what score the person got on the multiple choice test.


Thank you


Outsystems.PNG


Hi Lukasz,

for starters, if you want to store the score, you will need a place in your database for it.  You are now putting it in a client variable, which is a place to temporarily store information on the browser side as long as a users interaction/session has not expired.

So, I'm not really sure I understand your datamodel, I don't know what a 'Beck' is, but if each beck has a score, then add a score attribute in Beck.

If however, a 'Beck' is just part of a test, and the total test score is over several 'Becks', then you will have to add another entity with a 1-n relationship with the Becks.  Don't know enough about your use case to help you with this.

Dorine


EDIT : for a test taking system, your datamodel looks extremely simple to me.

maybe look at something like this for inspiration

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.