web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If Rules, to Access a ...
Power Apps
Answered

If Rules, to Access a Vertical Gallery, Linked to a Sharepoint List.

(0) ShareShare
ReportReport
Posted on by 12

Hi Everyone,

I am trying to create an inventory management tool.. same old problem that I know so many people on here have posted messages about, but I think my problem is a little different.

 

I've set up a very basic Power App so far from a sharepoint list.  There are 3 screens; which were primarily automatically created from the sharepoint list, when I clicked "Integrate, Power Apps, Create an App".

 

I have since created a Barcode Scanner, which identifies a serial number from a unique QR code, which would be attached to each item in the inventory, returning a 6 digit code.  I believe these would be in a text format, but this could be changed to a numerical format using the value (" ") function.

 

Below is a screenshot of two of the screens.  On the LHS, when the scan button is pressed, if the serial number returned from the barcode scanner, matches the serial number for the item of equipment in the inventory (stored in a connected Sharepoint list), then I want the user to get taken to the next screen, e.g. the RHS image.

Tim_Control_1-1667902213957.png

 

So far I have been trying with a few if rules with the OnScan feature;

 

  1. If(Value("BarcodeScanner_S1.Value")=Value("ThisItem.'Serial Number'"),Select(Parent),Set(varShowPopup,true))
  2. If("BarcodeScanner_S1.Value"="ThisItem.'Serial Number'",Select(Parent),Set(varShowPopup,true))

I believe the Select(Parent) function, will take me through to the second screen on the RHS depicted in the image above.  The Set(varShowPopup,true) is just to display a popup if the QR code / serial does not match, however this is a step ahead of where I am currently.

 

Neither of these work well at the moment though.  And I think this whole approach is wrong.  As I have tried created an additioanl if/logical test which creates a "1" or "0" in a text box, to assess what is going on.  Below is a screenshot of this. But basically I get a 1 (true) appearing in every single row of data, even when I can see the scanned value & equipment serial number don't match up.  Also you can see a 1 is automatically assigned to all gallery line items.. 

Tim_Control_4-1667904415012.png

(For clarity the numbers 54710 & 21311 are the numbers returned from the barcodescanner_S1.value.  These were inserted as a visual check / confirmation for myself).

 

Very keen to hear back thoughts from anyone on how to get around this.  Initially I am looking to ensure that the second screen can only be accessed it a QR code (attached to an item of equipment) is scanned.  Once I have achieved this, I will then be looking to set the Power App to automatically update a sepcific data set / column in "SharePoint List", e.g. the "Last Inspected by" Column for the item of equipment that has just been scanned.  But I am happy to start figuring out how to solve this problem afterwards 🙂

But I thought I would just mention it here, in case anyone thinks that I am going about this in the wrong approach, and that an alternative method may be more suitable.

Tim_Control_3-1667902888838.png

Thanks for all assistance in advance.

 

 

Categories:
I have the same question (0)
  • Waegemma Profile Picture
    583 Super User 2024 Season 1 on at

    Hi @Tim_Control ,

     

    It's a bit much to take in, but on first glance a minor adaption could help:

     

    In your version

     

    If(Value("BarcodeScanner_S1.Value")=Value("ThisItem.'Serial Number'"),Select(Parent),Set(varShowPopup,true))

     

    You compare the value of the two strings, not the value of the two references.

     

    Easy fix: drop the quotes (" ")

     

    If(Value(BarcodeScanner_S1.Value)=Value(ThisItem.'Serial Number'),Select(Parent),Set(varShowPopup,true))

     

    Same goes for:

     

    If("BarcodeScanner_S1.Value"="ThisItem.'Serial Number'",Select(Parent),Set(varShowPopup,true))

     

    Drop the quotes:

     

    If(BarcodeScanner_S1.Value=ThisItem.'Serial Number',Select(Parent),Set(varShowPopup,true))

     

    Hope this helps,

     

    Marc

  • Tim_Control Profile Picture
    12 on at

    Evening Marc,

     

    Appreciate you looking over this and coming back to me.  I did try dropping the quotes, but this appeared to introduce an error.  Not quite sure why that is though,.

    Tim_Control_0-1668118837094.png

     

    Tim_Control_1-1668118874353.png

    I'm not sure if it is to do with different data types / formats.  

     

    Perhaps i should try to explain again, but in short I'm trying to develop an app to perform the following functions:

    -provide operator a list of equipment (from a sharepoint list), which they have to inspect.

    -scan a QR code on each piece of equipment instructed

    -the power app will compare this QR code to a column of data in the same sharepoint list mentioned above,

    -power app will take user to a details "screen" for this equipment item, where it will automatically update some of the sharepoint data / list with new data about the operator who has inspected the equipment, today's date.

    -Operator can then repeat this for all items in the sharepoint list.

    -if QR codes, equipment scanned does not correlate to a sharepoint list, then no details in the sharepoint list will get automatically accessed / displayed / updated.

     

    So perhaps, based on that explanation, do you think that my idea's above are close to being a workable solution.  Or does anyone have a different idea which could deliver similar results.

     

    Thanks,

    Tim

  • Verified answer
    Waegemma Profile Picture
    583 Super User 2024 Season 1 on at

    Hi @Tim_Control ,

     

    Ok, now I get the picture.

     

    I made a mock-up version here. I'll walk you through it...

     

    Delete the BarCodeScanner you added to the Gallery.

    Change the size of the Gallery so you get some room between your TextInput and the Gallery.

    Add a BarCodeScanner here, and a Button.

    It should look a bit like this:

     

    Waegemma_0-1668125002903.png

     

    Then change the Items property of the Gallery:

     

    SortByColumns(
     Filter(
     [@VesselInventory];
     StartsWith(
     Title;
     TextSearchBox1.Text
     );
     IsBlank(BarcodeScanner1.Value) || SerialCode = BarcodeScanner1.Value
     );
     "Title";
     If(
     SortDescending1;
     Descending;
     Ascending
     )
    )

     

    You can replace [@VesselInventory] with the name of your Sharepoint List.

    Title is the column with the Vessel name.

    SerialCode is the column with the serial code.

    BarCodeScanner1 is the control (since you made a new one, the name may have changed)

     

    Screenshot of my mockup Sharepoint List:

     

    Waegemma_1-1668125448965.png

    ButtonResetScanner:

    Change the OnSelect:

     

    Reset(BarcodeScanner1)

     

    Ok. Now you user can search for the vessel, then scan and if the barcode is in the list, only one item will show.

    When they click on this, they get the next screen.

    This way if the scanner doesn't work, they can still manually select items and log their inspection.

     

    The search function can of course be more comprehensive, if you want to search on vessel and equipment, use:

     

    SortByColumns(
     Filter(
     [@VesselInventory],
     StartsWith(
     Title,
     TextSearchBox1.Text
     ) || StartsWith(
     Equipment,
     TextSearchBox1.Text
     ),
     IsBlank(BarcodeScanner1.Value) || SerialCode = BarcodeScanner1.Value
     ),
     "Title",
     If(
     SortDescending1,
     Descending,
     Ascending
     )
    )

     

    Hope this is what you were looking for,

     

    Marc

     

  • Tim_Control Profile Picture
    12 on at

    Hi Marc,

     

    Thanks for your help and thought put into the above post.  I've had a play around and created the same sharepoint list names etc, so that I could mirror what you had done too. 

     

    The intention of this QR code, is to be used as a security feature, where they cannot access the subsequent page, unless they have succesfully scanned the QR code.  So I think I failed to communicate this clearly unfortunately.

     

    However I have managed to acheive this now though, through adjusting the navigation buttons visibility using an If Function, as per the below screenshot.  I have also removed all other Navigate Functions from the Browse Gallery.

    Tim_Control_0-1668277454496.png

     

    I'm going to have a look around on the other forums to get some ideas for the next steps that I need solving.  but thank you for your help.

     

    Once again, thanks for your help Marc.


    Cheers,

    Tim

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard