Hello,
I have this code:
If(
!IsBlank(
LookUp(
Obrazy_obecnosc,
Last(
Split(
'Imię i nazwisko'.Claims,
"|"
)
).Result = Lower(User().Email) && DateValue(Text(Created)) = Today()
)
),
Patch(
Obrazy_obecnosc,
LookUp(
Obrazy_obecnosc,
Last(
Split(
'Imię i nazwisko'.Claims,
"|"
)
).Result = Lower(User().Email) && DateValue(Text(Created)) = Today()
),
{
Nazwa_zadania: Zadanie_nazwa.Text,
Opis_zadania: Zadanie_opis.Text
}
)
)
It saves data from inputboxes Nazwa_zadania and Opis_zadania to my Sharepoint list.
But it saves only one record.
My inputbox is in gallery and I can fill for example 10 such input boxes, but only last one will be saved.
I would like to save all data that is filled.
Is it possible?
Is it possible to save all input boxes?
Solved! Go to Solution.
@RandyHayes 's extrapolation of the code you supplied to add all items in the gallery is correct syntax based on what you posted, but I think I can see a flaw in the logic - you are saying if the record is not found, then Patch to that record (which does not exist). This may be what you are after
ForAll(
yourGallery.AllItems,
With(
{
record:
LookUp(
Obrazy_obecnosc,
Lower('Imię i nazwisko'.Email) = Lower(User().Email) &&
Text(Created, ShortDate) = Text(Today(), ShortDate)
)
},
If(
!IsBlank(record),
Patch(
Obrazy_obecnosc,
Defaults(Obrazy_obecnosc),
{
'Imię i nazwisko'.Email:Lower(User().Email),
Nazwa_zadania: Zadanie_nazwa.Text,
Opis_zadania: Zadanie_opis.Text
}
)
)
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
If I am understanding what you are needing correctly you need to use ForAll. You have multiple items in a gallery and want each line item to create a line item on your SharePoint List (or whatever data source you have). An example of how you would use this is:
ForAll(Gallery1.AllItems,
Patch(SPList, Defaults(SPList),
{Title: val_Title.Text,
{Column2: val_Name.Text}))
The Title and Column2 above would be the column names on your SharePoint list and the val_Title and val_Name would be labels with values in your gallery.
I don't typically do it straight from a gallery. I use a collection. When they select an item it goes into collection, gallery displays items in collection and my Patch looks to the collection for the values (instead of directly to gallery). But it can work either way.
Hope this helps!
Since you are pulling this information from the Gallery (which is already a collection), you need to simply perform your Patch function For All of the records in the collection.
This formula would be what you are looking for:
ForAll(yourGallery.AllItems,
With({record: LookUp(Obrazy_obecnosc, Lower('Imię i nazwisko'.Email) = Lower(User().Email) && Text(Created, ShortDate)) = Text(Today(), ShortDate))},
If(!IsBlank(record),
Patch(Obrazy_obecnosc,
record,
{
Nazwa_zadania: Zadanie_nazwa.Text,
Opis_zadania: Zadanie_opis.Text
}
)
)
)
)
Note: I noticed you were comparing the email address on the Imię i nazwisko column by splitting the claims column, you can reduce that overhead by just comparing the Email column as shown in the above formula.
Also, your date comparison may run into issues how you had it, so it is adjusted in the above formula.
I hope this is helpful for you.
Thank you, but it is not working 😞
I think that at the end there is one additional ).
Also it shows Invalid number of arguments received 1 expected 2 in With(records).
Also errors The function for all has some invalid arguments and unexpected characters.
Please scrub through the formulas I provide as I type them by hand without the aide of a design editor.
There was an extra paren in the formula. Change to the following (still might be some typos):
ForAll(yourGallery.AllItems,
With({record: LookUp(Obrazy_obecnosc, Lower('Imię i nazwisko'.Email) = Lower(User().Email) && Text(Created, ShortDate) = Text(Today(), ShortDate))},
If(!IsBlank(record),
Patch(Obrazy_obecnosc,
record,
{
Nazwa_zadania: Zadanie_nazwa.Text,
Opis_zadania: Zadanie_opis.Text
}
)
)
)
)
I cannot even test it 😞
When I had collection I could use command Collect to create new blank item in Gallery.
But when I switched to sharepoint list style new item is not created, and I do not know how to manage it.
My gallery has input box in it, and I want to make more empty boxes when I click a button.
@RandyHayes 's extrapolation of the code you supplied to add all items in the gallery is correct syntax based on what you posted, but I think I can see a flaw in the logic - you are saying if the record is not found, then Patch to that record (which does not exist). This may be what you are after
ForAll(
yourGallery.AllItems,
With(
{
record:
LookUp(
Obrazy_obecnosc,
Lower('Imię i nazwisko'.Email) = Lower(User().Email) &&
Text(Created, ShortDate) = Text(Today(), ShortDate)
)
},
If(
!IsBlank(record),
Patch(
Obrazy_obecnosc,
Defaults(Obrazy_obecnosc),
{
'Imię i nazwisko'.Email:Lower(User().Email),
Nazwa_zadania: Zadanie_nazwa.Text,
Opis_zadania: Zadanie_opis.Text
}
)
)
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
User | Count |
---|---|
126 | |
87 | |
84 | |
75 | |
69 |
User | Count |
---|---|
214 | |
178 | |
140 | |
105 | |
83 |