cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

On Start collection does not work

Hello,

 

I am having issues with a component which is supposed to call an API that fetches the user's IP to block / allow him access to the app if its IP is in between the IPs range set.

 

I am not sure it is the better solution for powerapp but I am still learning.

 

I have put the following code in the "OnStart" property of the app (the commented block is another try) :

 

ClearCollect(
    'MyIpRanges',
    {
        StartIP:"xyz.abc.138.150",
    EndIp:"xyz.abc.138.151"
    }
);

/*ClearCollect(
    'CanonIPs',
            {firstIP:"a.b.177.31"},
            {secondIP:"c.d.177.32"},
            {backupIP:"e.f.48.206"}
            )
            ;*/
            



Set(MyIp,'contoso_contoso.whitelist(00000001-0000-0000-0001-00000000009b)1'.OutPut);



If(IsBlank(MyIp) || CountRows(
                            Filter(
                                MyIpRanges,
                                (Value(Substitute(MyIp,".",""))) >= (Value(Substitute(StartIP,".",""))) &&
                                (Value(Substitute(MyIp,".",""))) <= (Value(Substitute(EndIp,".",""))))) = 0,
                                Navigate(RestrictedAccess),
                                Navigate(Screen1)
);

 I am getting the following error for 'MyIpRange' variable : "This name is not valid. This identifier is not recognizable."

The 'OnStart' property is showing "Unexpected characters. Formula contains "ParenClose" when "Error" is expected.

 

lhtdki_0-1649855377993.png

Thanks in advance for your help !

 

Loïc.

 

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

@Anonymous 

The existing reference is no longer valid so I would try changing it as follows:

Set(MyIp; ipWhitelistComponent1.OutPut);

View solution in original post

8 REPLIES 8
timl
Super User
Super User

@Anonymous 

As it appears that you're using Power Apps in French, I would try replacing the , characters with ; like so:

ClearCollect(
    'MyIpRanges';
    {
        StartIP:"xyz.abc.138.150";
    EndIp:"xyz.abc.138.151"
    }
);;

/*ClearCollect(
    'CanonIPs';
            {firstIP:"a.b.177.31"};
            {secondIP:"c.d.177.32"};
            {backupIP:"e.f.48.206"}
            )
            ;;*/
            



Set(MyIp;'contoso_contoso.whitelist(00000001-0000-0000-0001-00000000009b)1'.OutPut);;



If(IsBlank(MyIp) || CountRows(
                            Filter(
                                MyIpRanges;
                                (Value(Substitute(MyIp;".";""))) >= (Value(Substitute(StartIP;".";""))) &&
                                (Value(Substitute(MyIp;".";""))) <= (Value(Substitute(EndIp;".";""))))) = 0;
                                Navigate(RestrictedAccess);
                                Navigate(Screen1)
);;

 

Anonymous
Not applicable

@timlThank you for your assistance, it did solve an issue and opened several others (as expected 😀)

 

One of them is the "Name is not valid. Identifier is not recognized" for this line :

Set(MyIp; 'dev_contoso.whitelist(00000001-0000-0000-0001-00000000009b)1'.OutPut);

Could you please assist me again ?

Regards,

 

Loïc.

timl
Super User
Super User

Hi @Anonymous 

I assume 'dev_contoso.whitelist(00000001-0000-0000-0001-00000000009b)1' is a reference to a custom connector. If that's missing from your app, that would return a 'Name is not valid' error.

 

Anonymous
Not applicable

Hi @timl ,

It is a reference to a custom component that I added :

 

lhtdki_0-1649866049301.png

It was imported with its solution.

 

Edit : I had forgotten to tag you

timl
Super User
Super User

@Anonymous 

The existing reference is no longer valid so I would try changing it as follows:

Set(MyIp; ipWhitelistComponent1.OutPut);
Anonymous
Not applicable

@timl 

Thanks again for your help.

It is weird that when I import my coded component, two of them appear and the second 'whitelist' does contain the output I need as shown in this screenshot when I execute this command in my directory:

npm start run

lhtdki_0-1649929178352.png

 

I have tried to test it and display 'MyIp' in a label by setting the 'OnChange' property of a button with :

Set(MyIp; Text(whitelist2.OutPut))

But I get "Uncompatible type" wether I try to cast the SingleLine.Text result or not.

 

 

 

 

Anonymous
Not applicable

I figured I called this variable elsewhere in my canvas, now I have to figure how to debug my component not loading.

Thanks a lot for your help !

Anonymous
Not applicable

I figured I called this variable elsewhere in my canvas, now I have to figure how to debug my component not loading.

Thanks a lot for your help !

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.

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,227)