cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DAVIDPOWELL
Level: Powered On

I need to keep adding text to a datacard value if the conditions are true in other datacards.

What I need:
I need to keep adding text to a datacard value if the conditions are true in other datacards.
 
So.....
I have  a datacard 
Notes_DataCatrd3 - datacardvalue36
 and
 Other_Notes_DataCard2 - datacardvalue43
Using this formula  to only display the Notes_Datacard3 if 
!IsBlank(DataCardValue43.Text)
 
Now, I need to  also add the text from 
Other_Notes_DataCard2 - datacardvalue43
 
AND/OR
add the text from another datacard.
Rep_AgencyDataCard3- datacardvalue39  if the value in this datacard = "YES"
AND/OR
add the text from another datacard.
Custom_SupplierDataCard3- datacardvalue40  if the value in this datacard = "YES"
 
I had this SET statement working ok if i used it on a Navigate button but,
Will not work if i add it to an existing formula ?
 
For Instance:  this is from an Items property for a Gallery after a search is performed in a textbox.
Filter('[dbo].[v_sst_source_select_search]',
    (Toggle1.Value = true And FilterTextBox.Text = Brand)
    Or (Toggle1.Value = true And FilterTextBox.Text = Supplier_Name)
    Or (Toggle1.Value = true And FilterTextBox.Text = Supplier_Number)
    Or (Toggle1.Value = false And FilterTextBox.Text in Brand)
    Or (Toggle1.Value = false And FilterTextBox.Text in Supplier_Name)
    Or (Toggle1.Value = false And FilterTextBox.Text in Supplier_Number)
)
;Set(v_Notes,If(DataCardValue17.Text = "Yes" || DataCardValue19.Text = "Yes",DataCardValue16.Text & ";" & DataCardKey17.Text & ";" & DataCardKey19.Text,Notes_DataCard2.Default))
 
Apparently cant create a variable "v_notes" using   SET in a normal property formula ?
 
Thanks
fordraiders 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
EricLott
Level 10

Re: I need to keep adding text to a datacard value if the conditions are true in other datacards.

That's right, you can't use Set() in an Items property because it is not invoked. It is not an action such as a button click or a screen loading. Any property beginning with "On" can have those functions, though.

For this, you can use the ForAll() or AddColumns() function to loop through a collection and perform an action or build onto a collection, but that would have to happen on an "On..." property.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

View solution in original post

7 REPLIES 7
EricLott
Level 10

Re: I need to keep adding text to a datacard value if the conditions are true in other datacards.

That's right, you can't use Set() in an Items property because it is not invoked. It is not an action such as a button click or a screen loading. Any property beginning with "On" can have those functions, though.

For this, you can use the ForAll() or AddColumns() function to loop through a collection and perform an action or build onto a collection, but that would have to happen on an "On..." property.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

View solution in original post

DAVIDPOWELL
Level: Powered On

Re: I need to keep adding text to a datacard value if the conditions are true in other datacards.

Can I set up a variable when the form2 is visible:  such as 

Set(v_Notes2,If(DataCardValue39.Text = "Yes" || DataCardValue40.Text = "Yes",DataCardValue36.Text & ";" & DataCardKey39.Text & ";" & DataCardKey40.Text,Notes_DataCard3.Default))

 

 

call this after my filter  ??

Filter('[dbo].[v_sst_source_select_search]',
    (Toggle1.Value = true And FilterTextBox.Text = Brand)
    Or (Toggle1.Value = true And FilterTextBox.Text = Supplier_Name)
    Or (Toggle1.Value = true And FilterTextBox.Text = Supplier_Number)
    Or (Toggle1.Value = false And FilterTextBox.Text in Brand)
    Or (Toggle1.Value = false And FilterTextBox.Text in Supplier_Name)
    Or (Toggle1.Value = false And FilterTextBox.Text in Supplier_Number)
) v_Notes2
   somehow ?

 

Thanks

David

EricLott
Level 10

Re: I need to keep adding text to a datacard value if the conditions are true in other datacards.

Instead of having '[dbo].[v_sst_source_select_search]' as your filter data source, you would have something along these lines:

AddColumns('[dbo].[v_sst_source_select_search]',"v_Notes2",
If(SomeColumn = "Yes" || SomeColumn2 = "Yes",SomeColumn3 & ";" & SomeColumn4 & ";" & SomeColumn5,SomeColumn6)

This would add a column named "v_Notes2" to a table object using your data source. It will not make any actual changes to your source itself. So you would use that as your filter's data source and the rest would be the same.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

DAVIDPOWELL
Level: Powered On

Re: I need to keep adding text to a datacard value if the conditions are true in other datacards.

I think I understand but, i'm not trying to change any of the searching/filtering,

I'm trying to change the one field to add text to it based on conditions.

If adding this column and then being able to display it in a text box by referencing it , that would work ?

 

Dave

EricLott
Level 10

Re: I need to keep adding text to a datacard value if the conditions are true in other datacards.

Yes. So if I had a table called MyColors like this:

IDColorName
1001Red
1002Blue

I could do AddColumsn() like this:

 

AddColumns(MyColors,"IsRed",If(ColorName="Red","Yes","No"))

 

I end up with this:

IDColorNameIsRed
1001RedYes
1002BlueNo

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

 

DAVIDPOWELL
Level: Powered On

Re: I need to keep adding text to a datacard value if the conditions are true in other datacards.

Thank you, but I would still need my filters to happen ?  Sorry

 

Dave

EricLott
Level 10

Re: I need to keep adding text to a datacard value if the conditions are true in other datacards.

Filter() returns multiple rows, while Lookup() returns the first value. If you want to show a value in a textbox, it has to be one row. Using my example above, I could put this in a textbox Text property:

LookUp(MyColors,IsRed="Yes",ColorName)

 and you would get Red as a result.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,104)