cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

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
Highlighted
Resident Rockstar
Resident Rockstar

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
Highlighted
Resident Rockstar
Resident Rockstar

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

Highlighted
Post Patron
Post Patron

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

Highlighted
Resident Rockstar
Resident Rockstar

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.

Highlighted
Post Patron
Post Patron

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

Highlighted
Resident Rockstar
Resident Rockstar

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.

 

Highlighted
Post Patron
Post Patron

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

Highlighted
Resident Rockstar
Resident Rockstar

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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