cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

Set(varNewItem on OnStart NavigateToNew?

On my App, I have a form chooser gallery where if I click on the "+" icon to the right of each form, it navigates me to a new item screen.

However, if I click on the "eye/view" icon, I am taken to a gallery/list view screen where if I select a new item button in there I can set the varNewItem variable.

sudosaurus_1-1661346666963.png

What I want to do is to be able to do this on my home screen / form chooser.

 

This is the code I am using on my App OnStart property:

 

Set(
    clTheme,
    {
        clBlue: BlueSquare.Fill,
        clDarkBlue: DarkBlueSquare.Fill,
        clRed: RedSquare.Fill,
        clYellow: YellowSquare.Fill,
        clWhite: WhiteSquare.Fill,
        clGreen: GreenSquare.Fill
    }
);

Set(
    ftTheme,FontLabel.Font
);
ClearCollect(
colGalleryMenu,
{
MenuTitle: "Extra Care Application to keep a mobility scooter",
NavigateTo: ECAKMS_scrn,
NavigateToNew: ECAKMS_form_scrn
},
{
MenuTitle: "Extra Care Centra New Resident",
NavigateTo: ECCNR_scrn,
NavigateToNew: ECCNR_form_scrn
},
{
MenuTitle: "Extra Care Person Centered Fire Risk Assessment",
NavigateTo: ECPCFRA_scrn,
NavigateToNew: ECPCFRA_form_scrn
},
{
MenuTitle: "Extra Care Personal Emergency Evacuation Management Plan",
NavigateTo: ECOEEMP_scrn,
NavigateToNew: ECOEEMP_form_scrn
},
{
MenuTitle: "Older Persons Support Agreement",
NavigateTo: OPSA_scrn,
NavigateToNew: OPSA_form_scrn
},
{
MenuTitle: "Supported Housing Move Out Checklist",
NavigateTo: SHMOC_scrn,
NavigateToNew: SHMOC_form_scrn
},
{MenuTitle: "Support Plan Needs Assessment",
NavigateTo: SPNA_scrn,
NavigateToNew: SPNA_form_scrn
},
{MenuTitle: "Supported Housing Risk Assessment and Management Review",
NavigateTo: SHRAAMR_scrn,
NavigateToNew: SHRAAMR_form_scrn
},
{MenuTitle: "Support Plan",
NavigateTo: SP_scrn
}
);

 

 

Essentially I need to be able to put the "Set(varNewItem" into the "NavigateToNew" bit below:

{MenuTitle: "Support Plan Needs Assessment",
NavigateTo: SPNA_scrn,
NavigateToNew: SPNA_form_scrn

 

Any suggeestions on how to acheive this would be ace!

 

Thanks! 🙂

7 REPLIES 7
Nogueira1306
Super User
Super User

Why don't you try if/ switch?

 

Like this:

 

Switch(

ThisItem.MenuTitle,

"Support Plan Needs Assessment",

Navigate(SPNA_form_scrn),

...

)

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

My website!

sudosaurus
Post Prodigy
Post Prodigy

@Nogueira1306 

How would I incorporate that into the above?

Nogueira1306
Super User
Super User

Nogueira1306_0-1661348117439.png

 

On property OnSelect of each one of your buttons

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

My website!

sudosaurus
Post Prodigy
Post Prodigy

@Nogueira1306 

Those items are in a gallery - hence the App OnStart property and the above code..

In the first button you write:

 

Switch(

ThisItem.MenuTitle,

"Support Plan Needs Assessment",

Navigate(SPNA_form_scrn),

...

)

 

You need to write an option for each one of your options (suport plan, odler person, etc)

 

Then you repeat but for the second button...

 

sudosaurus
Post Prodigy
Post Prodigy

@Nogueira1306 ah OK, so the "..." is there I put the additional options right?

and at which point do I insert this bit below? as that is a requirement to show the required fields in new/edit mode.

as if I just navigate to that screen, the fields don't appear...

 

Set(varNewItem,true);
Set(varSelectedItem,Defaults('Support Plan Needs Assessment'));

"..." are the rest of the options.

 

Switch(

ThisItem.MenuTitle,

"Support Plan Needs Assessment",

Set(varNewItem,true);
Set(varSelectedItem,Defaults('Support Plan Needs Assessment'));

Navigate(SPNA_form_scrn),

...

)

 

Check if that works

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

My website!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,251)