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.

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

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

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

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!

Armando Gomes wrote:

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!

Both Seems good approach. 


Armando Gomes wrote:

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!

Hi Armando,

Thanks for responding to my request. Can you please advise how can I achieve this? Can you please give me an example? Thanks.


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!

Armando Gomes wrote:

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!

Hi Armando,

I manage to do the show and hide of the input control based on selection of Activity type using if and a user function. Now I still could not set the activity creation date based on null ID for the activity. Secondly I am still struggling with the RACIFID and the working store based on the login user. Can you please give some example for me to sort these two issue thanks.


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!

Solution

Armando Gomes wrote:

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!

Hi Armando, thank you very much for your help. I used your On After Fetch function clue to not only sort out the date for activity creation but I also sorted out the RACIFID and the TechniciansWorkingStore by adding the aggregate (TFTechnician, then applied the User_GetName() filter for the RACIFID). Then to get the working store (I added the aggregate TFStore plus the TFTechnician and then applied the User_GetName() filter) to get the working store in the same function. I think I have done it correctly. The proof of the concept will be proven when I will start adding the activities based on the logged in user. Once again thank you for given me the best clue (On After Fetch).