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

COMPLICATED IF FUNCTION.

I am trying to make an app to collect info as containers are loaded in the field. i have FINALLY suceeded in making the basic app work, and it does collect info. Now, I am trying to add some validation to different fields.

 

The CONTAINER field will contain a container number which has a specific formula (ISO 6346) to evaluate if the number is correct. More info and code samples are HERE.

 

We were using Excel to run an If function and it works great, but when trying to adapt that If function to PA i get  lot of errors.

I know PA can run If, Len, and Mid; so is it just too much for PA to handle? or am i going about this the wrong way?

 

I would greatly appreciate any ideas.

-TIA

(i am trying to use containerid as a global variable with a button to set it and trigger the validation)

If(Len(containerid)=11,
If((Mid(containerid,11,1)*1)=(1*SUBSTITUTE((If(Mid(containerid,1,1)="A",10,If(Mid(containerid,1,1)="B",12,If(Mid(containerid,1,1)="C",13,If(Mid(containerid,1,1)="D",14,

If(Mid(containerid,1,1)="E",15,If(Mid(containerid,1,1)="F",16,If(Mid(containerid,1,1)="G",17,If(Mid(containerid,1,1)="H",18,If(Mid(containerid,1,1)="I",19,

If(Mid(containerid,1,1)="J",20,If(Mid(containerid,1,1)="K",21,If(Mid(containerid,1,1)="L",23,If(Mid(containerid,1,1)="M",24,If(Mid(containerid,1,1)="N",25,

If(Mid(containerid,1,1)="O",26,If(Mid(containerid,1,1)="P",27,If(Mid(containerid,1,1)="Q",28,If(Mid(containerid,1,1)="R",29,If(Mid(containerid,1,1)="S",30,

If(Mid(containerid,1,1)="T",31,If(Mid(containerid,1,1)="U",32,If(Mid(containerid,1,1)="V",34,If(Mid(containerid,1,1)="W",35,If(Mid(containerid,1,1)="X",36,

If(Mid(containerid,1,1)="Y",37,If(Mid(containerid,1,1)="Z",38,FALSE)))))))))))))))))))))))))))+

(If(Mid(containerid,2,1)="A",10,If(Mid(containerid,2,1)="B",12,If(Mid(containerid,2,1)="C",13,If(Mid(containerid,2,1)="D",14,If(Mid(containerid,2,1)="E",15,

If(Mid(containerid,2,1)="F",16,If(Mid(containerid,2,1)="G",17,If(Mid(containerid,2,1)="H",18,If(Mid(containerid,2,1)="I",19,If(Mid(containerid,2,1)="J",20,

If(Mid(containerid,2,1)="K",21,If(Mid(containerid,2,1)="L",23,If(Mid(containerid,2,1)="M",24,If(Mid(containerid,2,1)="N",25,If(Mid(containerid,2,1)="O",26,

If(Mid(containerid,2,1)="P",27,If(Mid(containerid,2,1)="Q",28,If(Mid(containerid,2,1)="R",29,If(Mid(containerid,2,1)="S",30,If(Mid(containerid,2,1)="T",31,

If(Mid(containerid,2,1)="U",32,If(Mid(containerid,2,1)="V",34,If(Mid(containerid,2,1)="W",35,If(Mid(containerid,2,1)="X",36,If(Mid(containerid,2,1)="Y",37,

If(Mid(containerid,2,1)="Z",38,FALSE))))))))))))))))))))))))))*2)+
(If(Mid(containerid,3,1)="A",10,If(Mid(containerid,3,1)="B",12,If(Mid(containerid,3,1)="C",13,If(Mid(containerid,3,1)="D",14,If(Mid(containerid,3,1)="E",15,

If(Mid(containerid,3,1)="F",16,If(Mid(containerid,3,1)="G",17,If(Mid(containerid,3,1)="H",18,If(Mid(containerid,3,1)="I",19,If(Mid(containerid,3,1)="J",20,

If(Mid(containerid,3,1)="K",21,If(Mid(containerid,3,1)="L",23,If(Mid(containerid,3,1)="M",24,If(Mid(containerid,3,1)="N",25,If(Mid(containerid,3,1)="O",26,

If(Mid(containerid,3,1)="P",27,If(Mid(containerid,3,1)="Q",28,If(Mid(containerid,3,1)="R",29,If(Mid(containerid,3,1)="S",30,If(Mid(containerid,3,1)="T",31,

If(Mid(containerid,3,1)="U",32,If(Mid(containerid,3,1)="V",34,If(Mid(containerid,3,1)="W",35,If(Mid(containerid,3,1)="X",36,If(Mid(containerid,3,1)="Y",37,

If(Mid(containerid,3,1)="Z",38,FALSE))))))))))))))))))))))))))*4)+
(If(Mid(containerid,4,1)="A",10,If(Mid(containerid,4,1)="B",12,If(Mid(containerid,4,1)="C",13,If(Mid(containerid,4,1)="D",14,If(Mid(containerid,4,1)="E",15,

If(Mid(containerid,4,1)="F",16,If(Mid(containerid,4,1)="G",17,If(Mid(containerid,4,1)="H",18,If(Mid(containerid,4,1)="I",19,If(Mid(containerid,4,1)="J",20,

If(Mid(containerid,4,1)="K",21,If(Mid(containerid,4,1)="L",23,If(Mid(containerid,4,1)="M",24,If(Mid(containerid,4,1)="N",25,If(Mid(containerid,4,1)="O",26,

If(Mid(containerid,4,1)="P",27,If(Mid(containerid,4,1)="Q",28,If(Mid(containerid,4,1)="R",29,If(Mid(containerid,4,1)="S",30,If(Mid(containerid,4,1)="T",31,

If(Mid(containerid,4,1)="U",32,If(Mid(containerid,4,1)="V",34,If(Mid(containerid,4,1)="W",35,If(Mid(containerid,4,1)="X",36,If(Mid(containerid,4,1)="Y",37,

If(Mid(containerid,4,1)="Z",38,FALSE))))))))))))))))))))))))))*8)+
(Mid(containerid,5,1)*16)+(Mid(containerid,6,1)*32)+(Mid(containerid,7,1)*64)+(Mid(containerid,8,1)*128)+(Mid(containerid,9,1)*256)+(Mid(containerid,10,1)*512)-11*ROUNDDOWN((((If(Mid(containerid,1,1)="A",10,If(Mid(containerid,1,1)="B",12,If(Mid(containerid,1,1)="C",13,

If(Mid(containerid,1,1)="D",14,If(Mid(containerid,1,1)="E",15,If(Mid(containerid,1,1)="F",16,If(Mid(containerid,1,1)="G",17,If(Mid(containerid,1,1)="H",18,

If(Mid(containerid,1,1)="I",19,If(Mid(containerid,1,1)="J",20,If(Mid(containerid,1,1)="K",21,If(Mid(containerid,1,1)="L",23,If(Mid(containerid,1,1)="M",24,

If(Mid(containerid,1,1)="N",25,If(Mid(containerid,1,1)="O",26,If(Mid(containerid,1,1)="P",27,If(Mid(containerid,1,1)="Q",28,If(Mid(containerid,1,1)="R",29,

If(Mid(containerid,1,1)="S",30,If(Mid(containerid,1,1)="T",31,If(Mid(containerid,1,1)="U",32,If(Mid(containerid,1,1)="V",34,If(Mid(containerid,1,1)="W",35,

If(Mid(containerid,1,1)="X",36,If(Mid(containerid,1,1)="Y",37,If(Mid(containerid,1,1)="Z",38,FALSE)))))))))))))))))))))))))))+(If(Mid(containerid,2,1)="A",10,If(Mid(containerid,2,1)="B",12,If(Mid(containerid,2,1)="C",13,If(Mid(containerid,2,1)="D",14,If(Mid(containerid,2,1)="E",15,

If(Mid(containerid,2,1)="F",16,If(Mid(containerid,2,1)="G",17,If(Mid(containerid,2,1)="H",18,If(Mid(containerid,2,1)="I",19,If(Mid(containerid,2,1)="J",20,

If(Mid(containerid,2,1)="K",21,If(Mid(containerid,2,1)="L",23,If(Mid(containerid,2,1)="M",24,If(Mid(containerid,2,1)="N",25,If(Mid(containerid,2,1)="O",26,

If(Mid(containerid,2,1)="P",27,If(Mid(containerid,2,1)="Q",28,If(Mid(containerid,2,1)="R",29,If(Mid(containerid,2,1)="S",30,If(Mid(containerid,2,1)="T",31,

If(Mid(containerid,2,1)="U",32,If(Mid(containerid,2,1)="V",34,If(Mid(containerid,2,1)="W",35,If(Mid(containerid,2,1)="X",36,If(Mid(containerid,2,1)="Y",37,

If(Mid(containerid,2,1)="Z",38,FALSE))))))))))))))))))))))))))*2)+(If(Mid(containerid,3,1)="A",10,If(Mid(containerid,3,1)="B",12,If(Mid(containerid,3,1)="C",13,If(Mid(containerid,3,1)="D",14,If(Mid(containerid,3,1)="E",15,

If(Mid(containerid,3,1)="F",16,If(Mid(containerid,3,1)="G",17,If(Mid(containerid,3,1)="H",18,If(Mid(containerid,3,1)="I",19,If(Mid(containerid,3,1)="J",20,

If(Mid(containerid,3,1)="K",21,If(Mid(containerid,3,1)="L",23,If(Mid(containerid,3,1)="M",24,If(Mid(containerid,3,1)="N",25,If(Mid(containerid,3,1)="O",26,

If(Mid(containerid,3,1)="P",27,If(Mid(containerid,3,1)="Q",28,If(Mid(containerid,3,1)="R",29,If(Mid(containerid,3,1)="S",30,If(Mid(containerid,3,1)="T",31,

If(Mid(containerid,3,1)="U",32,If(Mid(containerid,3,1)="V",34,If(Mid(containerid,3,1)="W",35,If(Mid(containerid,3,1)="X",36,If(Mid(containerid,3,1)="Y",37,

If(Mid(containerid,3,1)="Z",38,FALSE))))))))))))))))))))))))))*4)+(If(Mid(containerid,4,1)="A",10,If(Mid(containerid,4,1)="B",12,If(Mid(containerid,4,1)="C",13,If(Mid(containerid,4,1)="D",14,If(Mid(containerid,4,1)="E",15,

If(Mid(containerid,4,1)="F",16,If(Mid(containerid,4,1)="G",17,If(Mid(containerid,4,1)="H",18,If(Mid(containerid,4,1)="I",19,If(Mid(containerid,4,1)="J",20,

If(Mid(containerid,4,1)="K",21,If(Mid(containerid,4,1)="L",23,If(Mid(containerid,4,1)="M",24,If(Mid(containerid,4,1)="N",25,If(Mid(containerid,4,1)="O",26,

If(Mid(containerid,4,1)="P",27,If(Mid(containerid,4,1)="Q",28,If(Mid(containerid,4,1)="R",29,If(Mid(containerid,4,1)="S",30,If(Mid(containerid,4,1)="T",31,

If(Mid(containerid,4,1)="U",32,If(Mid(containerid,4,1)="V",34,If(Mid(containerid,4,1)="W",35,If(Mid(containerid,4,1)="X",36,If(Mid(containerid,4,1)="Y",37,

If(Mid(containerid,4,1)="Z",38,FALSE))))))))))))))))))))))))))*8)+(Mid(containerid,5,1)*16)+(Mid(containerid,6,1)*32)+(Mid(containerid,7,1)*64)+(Mid(containerid,8,1)*128)+(Mid(containerid,9,1)*256)+(Mid(containerid,10,1)*512))/11),0),10,0)),”VALID”,”NOT_VALID”),"")

10 REPLIES 10
WillPage
Impactful Individual
Impactful Individual

Slightly cleaner version:

If(
                Value <= 3,
                Code1 + RoundDown(
                    Code1 / 11,
                    0
                ) - 60 + If(
                    Code1 in [76,86,87],
                    1,
                    0
                ),
                Value(Character)
            )

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,452)