117
Views
10
Comments
Solved
Time Sheet

Hi, I am a new developer and learning to develop an app that will help the remote technicians to record their activities. I have manage to create the app with appropriate entities and detail screens. I managed to create the Activity form. Now when the technician creates a new activity then I want to automatically load the value for the input called "Technicians RACIF" on the form based on the login user and selected value of the activity type e.g. the user ID should be based on the login user ID, working store should be based on the login ID. 

Also the Emergency/OT input box should only show if the Technician select the appropriate activity type and should disappear if the activity type is changed. 

The date for the activity creation should auto fill. 

I think the above could be achieved by manipulating the aggregate and the widget control but I am unable to do this, so need help from the clever developers out there. I am attaching the screen shots and .oml of my app. Any help will be appreciated.

TimeSheet.oml

mvp_badge
MVP
Rank: #56
Solution

Hello Badar,

As I said, you can use the OnAfterFetch event:

You can then check if it's empty and then assign the default value:

I haven't tried this myself but in theory, it should work.


Regarding the RACIF Id, you could use the same approach, although you don't seem to have any relation to the user entity. Your TFTechnicians entity needs to reference the UserId in order to be able to know which Technician is the current user.

For the Working Store, the same could be applicable.


I can't give a definitive answer because I'm not sure what you want to do. Shall the working store have all the options or just the option for that technician? Although what's stated before should be a good starting point.


Cheers!

Rank: #9611

Some screen shots, was not able to upload with my post

EmergencyandOTinput.png

Rank: #9611

Some screen shots, was not able to upload with my post

Activitycreationdate.png

Rank: #9611

Some screen shots, was not able to upload with my post

LoginTechnicianRACIFIDandStore.png

mvp_badge
MVP
Rank: #56

Badar Nasir wrote:

Hi, I am a new developer and learning to develop an app that will help the remote technicians to record their activities. I have manage to create the app with appropriate entities and detail screens. I managed to create the Activity form. Now when the technician creates a new activity then I want to automatically load the value for the input called "Technicians RACIF" on the form based on the login user and selected value of the activity type e.g. the user ID should be based on the login user ID, working store should be based on the login ID. 

Also the Emergency/OT input box should only show if the Technician select the appropriate activity type and should disappear if the activity type is changed. 

The date for the activity creation should auto fill. 

I think the above could be achieved by manipulating the aggregate and the widget control but I am unable to do this, so need help from the clever developers out there. I am attaching the screen shots and .oml of my app. Any help will be appreciated.


Badar,


You can control the visibility of the inputs either by using an IF widget in which the condition is tied to the selected ActivityType or by using the Visible property of the parent container. I strongly suggest the first.


Regarding the date, on the after fetch action, you can set the value for the current date time if the variable is null date.


Cheers!

mvp_badge
MVP
Rank: #56

Badar,

For the if widget: https://www.outsystems.com/learn/lesson/1928/demo-how-to-use-a-if-widget?LearningPathId=18

For the second question, use a new client action for the On After Fetch property of your aggregate to manipulate the data.

Cheers!

mvp_badge
MVP
Rank: #56
Solution

Hello Badar,

As I said, you can use the OnAfterFetch event:

You can then check if it's empty and then assign the default value:

I haven't tried this myself but in theory, it should work.


Regarding the RACIF Id, you could use the same approach, although you don't seem to have any relation to the user entity. Your TFTechnicians entity needs to reference the UserId in order to be able to know which Technician is the current user.

For the Working Store, the same could be applicable.


I can't give a definitive answer because I'm not sure what you want to do. Shall the working store have all the options or just the option for that technician? Although what's stated before should be a good starting point.


Cheers!