cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
balys
Frequent Visitor

How to do a OnStart with SQL connector and a IF statement

Hello All,

 

I have table Settings - In the table Columns SettingName and SettingValue 

The task is to Run a Screen named ConfigurationScreen if 

  • SettingName InitialWizardCompleted
  • SettingValue 0

I understand I need to do that on App setting OnStart  whith a IF statement, but I can not my head around it. 

 

If(

SettingValue.InitialWizardCompleted="0", Did not work

 

Settings, LookUp( Settings, SettingValue= "InitialWizardCompleted" ), { SettingValue: "0" } Did not work

 

IF TRUE

Navigate(ConfigurationScreen),

IF FALSE

Navigate(MainScreen))

 

Please help me. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@balys 

Navigation in the OnStart is not supported any longer.  This needs to be done in the StartScreen.

When you say "still the same" can you describe what is the same?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@balys 

You will want to do this in the StartScreen property of the app instead of the OnStart.

The formula should be:

If(Coalesce(LookUp(Settings, SettingValue= "InitialWizardCompleted", SettingValue), 0) = 0,
    ConfigurationScreen,
    MainScreen
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

The system takes the FX, but tried it on StartScreen as you suggested and OnStart - still the same. 

RandyHayes
Super User
Super User

@balys 

Navigation in the OnStart is not supported any longer.  This needs to be done in the StartScreen.

When you say "still the same" can you describe what is the same?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Ok, understood why not to use OnStart - EOL. 

The Configuration screen still does not come up as before, but SQL database InitialWizardCompleted is set to zero

balys_0-1643182047693.png

I updated table by running: 

UPDATE Settings
Set SettingValue= '0'
WHERE SettingName = 'InitialWizardCompleted'

 

Could it be that I insert text value and the IF statement is looking for a number? 

 

 

balys
Frequent Visitor

@RandyHayes 

Your command worked when I changed a SettingValue to SettingName

 

If(Coalesce(LookUp(Settings, SettingValue= "InitialWizardCompleted", SettingValue), 0) = 0,
    ConfigurationScreen,
    MainScreen
)

 

Helpful resources

Announcements
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.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,606)