Beginner Question - Web App creating data

I am new to Outsystems and want to do something that, to me seems simple. I want a simple two page dialog. Page 1 CREATEs two related entities - say Company(Me) and Users(Me) - then Page 2 accesses some Attributes from those Entities but not all and adds a bunch of additional data to both Company(Me) and User(Me) and UPDATES. 

Setting up the Entities in the Data tab is easy but I cant find an example of CREATE - all of the examples seem to be pulling in all of the attributes from an Entity into an aggregate, list everything and then update everything.

Where do I find help to start with an "empty" database, add the mandatory fields, CREATE the records, pass the resulting Identifiers, and then Fetch the rows for Update and then modify the defaulted fields and Update.
To me this seems like a really basic, Entity based example with the emphasis on a single row and it's attributes - but I'm always lead to rows of all attributes, which both logically and visually is the wrong Metaphor.

Help?

Hi Gordon,

First of all I would advice you to follow the 'Guided path web developer' to learn all the basics on how you can develop web applications with OutSystems.

That said the steps you need to do to implement your case are:

  • Define entity for company with all the attributes you need on it with proper datatype, length and mandatory set.
  • Regarding users do you mean the OutSystems Userentity or an entity of your own ?
    • If you mean the OutSystems user entity and you want those to be assigned to a company you need to make a UserCompany entity with UserId as primary key (no autonumber) and CompanyId as foreign key
    • OR Create tje IserCompany entity and add CompanyId and some attributes for the user details 
  • Make sure that on each entity you put the attributes you want to see in a list overview as the first 4 attributes after the Id. This way when you schafold screens they are already in the table records.
  • Now you can drag the company entity to the MainFlow, it will create a list screen
  • Then drag the entity one more time to the mainflow now it will create a detail screen for company and link it to the list screen.
  • Now open the detail company screen and drag the UserCompany entity underneath the save cancel button.

That should get you somewhere.

Good luck with it.

Regards,

Daniel

Daniel,  thanks for the reply. I guess this might help me hack what I want to do. The main difference is, I don't want to do a list. I want to create and update the two entities - actually one entity would be fine; I can mess with foreign keys once I get the basics. 

Listing the attributes as columns in a table is a pretty ugly ux metaphor to create an entity.


I tried the beginners course, it is very slow, and I still couldn't find anything that helped me solved this particular problem. 


Anyway,  thanks again. 

Hello Gordon,

The beginner course is not slow. It's a week course. It has the minimun information that you need to learn in order to use the platform in an appropriated way. And all you need to know in order to create records in an entity is teached in the first three days.

So, do not hush. Three days is not "going slow". A proper education will compensate in the end, instead of trying to find shortcuts, that usually lead to bad results in the long run. 

And, or you didn't understand what Daniël explained, or we didn't understand what you asked.

Daniel teached you how to create a List Page and a Detail page (where you can add/edit records). He was not trying to create a "metaphor". One page lists the existing records and gives you access to edit or create records in the detail page. That's it.

So, if this is not what you want, could you explain further what you are trying to do? Because if you are trying to "create" entities (tables) dynamically, I'll say that you will not be able to do this directly from an OutSystems application, even if it is possible using extensions and if you have direct access to the database (not the case with Personal Environments) or an external database.

Cheers.

Okay, now I am totally confused. I can see a create "method" on the entity. I am not trying to dynamical add an entity. i am simple trying to start without listing the existing data,  because there won't be any when I start. 

What I am trying to do is very simple. Add a row to an entity without listing any existing rows in the same table. I want to build a web page to ask someone to provide their name, address, phone etc. Then store it where ever outsystems persists the data, then read it back and update it from a second page. A table showing other rows or all the attributes would be a very unfriendly user experience. 

It's about the second simplest example after list existing database contents but I can't find doc explaining how to do it. Okay 3rd after "hello world".

That's it. I shouldn't have to invest a week in education to build something that simple. Plus, as far add I can tell, the beginners course doesn't cover this case - I did several units  in detail bthen fast tracked through some others. If it is there, then a link to that lesson would be all I need. 

I seen doing this to evaluate the impact of outsystems on my development teams productivity over traditional methods. So far, it had been easy to do a "list of a join" but Create usually comes before Read in CRUD. 

I thanked Daniel for his suggestion and was going to try it the easy he described to see if it would clue me in to what I need to do to solve my problem. 



Hi Gordon, 

When you create an entity it has some entity actions associated to it, like the Create and the Update Actions, that you can use to insert new rows or update existing rows. 

What you need is covered in the Data Modeling, List & Detail and Screen Interaction chapters and exercises. 

But what Daniel told is the easiest way for achieving this. 

After creating your entity, you just drag & drop the entity to the flow twice, and it will create for you a List page and a Detail page. With both you can add new records to the entity and list the content. And you can investigate the code generated to see how this is done. It's a one second operation that gives you what you need. 

But the training course was not designed to be done by parts. It was designed to cover all the basic stuff in a way that make it easier to understand and assimilate the required concepts to program in OutSystems. 

It is a different paradigm from the traditional way of program and so, it really need this investment in time (a week) for a programmer to be able to shift the way they see things and understand how things work. 

You also have the online documentation, if you want a place easier to search content, but I always recommend the training for thos are starting in OutSystems. 

It's a week, but it is worth. 

Regarding evaluating the platform, you probably would be better talking directly to OutSystems. They have a guide for this here, but talking to them directly would be better, I think. 


P. S. I'll ask someone from OutSystems to reach you to see if they can help you with the platform evaluation. 

Gordon -

If you look at the screens that were created, the XYZ list screen should have a "Create XYZ..." link in the top right that points to the XYZ detail screen, passing in a null identifier() for the XYZ Id parameter. This will have the screen load with nothing filled in, so you can create a new record (exactly what you are asking for if I understand it). If you don't want to see the list first, just direct someone to that XYZ detail screen with a null identifier to get a screen to make the new record.

If you want to make this automatic, in the Preparation of the XYZ list screen, check to see with an "If" if the "GetXYZs" query's .List.Empty property is true... and if it is, send them to the XYZ detail screen, passing a null identifier, instead of going to the End of the preparation.

This will do exactly what you want.

That said, I am going to reinforce what the others have said here, in that spending some time with the learning materials seems very much in order. There's nothing complex about the logic here ("on my list screen, if there are no records found, send them to the detail screen to create one"), but because you lack the basic information on what you can and cannot do in the tool, it's going to be very frustrating for you to get anything done here.

J.Ja

Justin James wrote:

Gordon -

If you look at the screens that were created, the XYZ list screen should have a "Create XYZ..." link in the top right that points to the XYZ detail screen, passing in a null identifier() for the XYZ Id parameter. This will have the screen load with nothing filled in, so you can create a new record (exactly what you are asking for if I understand it). If you don't want to see the list first, just direct someone to that XYZ detail screen with a null identifier to get a screen to make the new record.

If you want to make this automatic, in the Preparation of the XYZ list screen, check to see with an "If" if the "GetXYZs" query's .List.Empty property is true... and if it is, send them to the XYZ detail screen, passing a null identifier, instead of going to the End of the preparation.

This will do exactly what you want.

That said, I am going to reinforce what the others have said here, in that spending some time with the learning materials seems very much in order. There's nothing complex about the logic here ("on my list screen, if there are no records found, send them to the detail screen to create one"), but because you lack the basic information on what you can and cannot do in the tool, it's going to be very frustrating for you to get anything done here.

J.Ja

Thanks and I did spend 5 hours or so going through the video course but eventually got frustrated with the flow and started trying to search the doc and then pinged the bot then dropped the question on the forum.
This is far from my first "new development tool", even designed a few, and one of the ways people adopt them is trying to do simple things they know how to do in other technologies.

I am getting that listing an entity before you act on it is the normal way outsystems studio does it - everyone who helped has started with the same step. I find it a bit weird but I suspect I can take a look at the code, as you suggest, and work out what's happening.

I do find it strange, that when I signed up for the personal environment, it didn't provide me with a list of everyone who already had signed up before taking me to the account create screen - Just Kidding :)

Thanks for taking the time to go into specifics - the forum is great so far.

Cheers, Gordon


Eduardo Jauch wrote:

P. S. I'll ask someone from OutSystems to reach you to see if they can help you with the platform evaluation. 

Thanks - I already have a support contact and will, at some point, have to talk commercial terms, so will go through the demo and sales engineer path in the near future. No need to do the extra reach out - I am good. Confused by the approach but good that it is the normal way.


Cheers, Gordon


Hi Gordon,

I have exactly the same use case as you do, I have completed the Web Developer course, and didn't find the answer there either.  I am not sure whether the use case has quite been understood by others so I'll see if I can articulate it in a way that may get a little more traction:

1.  The use case is about registering users (e.g. a customer) for our application and (optionally) the organisation they belong to.

2.  We want a blank 'register user' or 'create account' screen to start with.

3.  No record of the user or account currently exists.

4.  The user will populate the fields on the screen to register or create their account which will be persisted in the database.

5.  We do not want to share this screen with the 'update user' or 'update account' functionality.

6.  Once the user or account has been created, then the list / detail screen paradigm works fine.

The key point for me is point 5: I'm not keen on sharing a 'register user / create account' designed for unregistered users with the 'update user / update account' designed for registered users, I would rather keep them separate.

Does this provide any clarification ?

Cheers, Richard. 

Hello Richard, 

The training course is meant to help learning OutSystems programming and as so, it will not have specific use cases, but only the most common use cases as support to do so. 

There is a Forge module showing how to do what you need. It was made for version 9, but there wasn't many changes to the User since then. 

https://www.outsystems.com/forge/component-overview/1111/how-to-user-self-register

You have also this one: https://www.outsystems.com/forge/component-versions/3706

Here you find information on End User management in OutSystems: https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application/End-User_Management

And here the reference to the Users API: https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/Users_API

From the training, you learn how to create users using the Users application. But also how to create a detail page and save data to database. If you want to allow users to register themselves the basic steps are basically provide a page with a form for get the required data, hash the password, create a new record into user entity (from system) and eventually grant some roles for them. With a few more details that the previous links will help you sort it out. 

Hope this helps. 

Cheers. 

P. S. If you want just to allow self registering in this page (no update), use a User local variable at the page level as source for the Form and use the CreateUser instead of the CreateOrUpdate entity action. 

Richard - Yes, exactly

And I suspect Eduardro's P.S. may be a key - I know I can build the appropriate UI with local variables, just couldn't get the Create triggered - if I can point the Create method associated with the Entity folder Customer to the Local variable Customer, it should work and hopefully return the autogenerated ID to the Local entity which I can then pass forward as input to the next detail page - after all that is roughly what I would do in other programming environments.

I will say, for all that this simple pattern is frustrating, the Forum is very responsive - which tells me some people are very committed to the tool.

@Eduardo - are there any "gottchas" you know about with using the Forge and the Personal environment?