Hello guys,
I am struggeling hard with that. First I tell you what i wanted to achieve. This is My Shopping Cart Site
You can choose an Employee and then Put it in a shopping card... you know
Now I had the Problem For every Item a new entry was made.
Sometimes you have to correct something and add another one to the cart... so i though instead of making a new item, i wanted to update the Quantities.
Therefore i had the blue button (test) with the following code
If(
CountIf(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterName = ComboBox_Search_Employee_Software_1.Selected.DisplayName
) > 0,
UpdateIf(
Licence_Shopping_Cart,
(First(
Filter(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email
)
).Name = ThisItem.Title && First(
Filter(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email
)
).MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email),
{
Quantity: First(
Filter(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email
)
).Quantity + Int(TextInput2.Text)
}
),
Collect(
Licence_Shopping_Cart,
{
Name: ThisItem.Title,
Quantity: Int(TextInput2.Text),
MitarbeiterName: ComboBox_Search_Employee_Software_1.Selected.DisplayName,
MitarbeiterMail: ComboBox_Search_Employee_Software_1.Selected.Email
}
)
)
The Problem now is. Sometimes it works, sometimes it doesn't. I see no pattern.
What am I doing wrong?
Or have you any other ideas to achieve this simpler
Solved! Go to Solution.
Hi @RiccoHipp1903 ,
Your formula seems too complicated, please try below first and see if it could work:
If(
CountIf(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterName = ComboBox_Search_Employee_Software_1.Selected.DisplayName
) > 0,
UpdateContext({varQuantity:LookUp(Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email,Quantity)+ Int(TextInput2.Text});
Update(
LookUp(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email
),
{
Quantity: varQuantity
}
),
Collect(
Licence_Shopping_Cart,
{
Name: ThisItem.Title,
Quantity: Int(TextInput2.Text),
MitarbeiterName: ComboBox_Search_Employee_Software_1.Selected.DisplayName,
MitarbeiterMail: ComboBox_Search_Employee_Software_1.Selected.Email
}
)
)
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hi @RiccoHipp1903 ,
Your formula seems too complicated, please try below first and see if it could work:
If(
CountIf(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterName = ComboBox_Search_Employee_Software_1.Selected.DisplayName
) > 0,
UpdateContext({varQuantity:LookUp(Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email,Quantity)+ Int(TextInput2.Text});
Update(
LookUp(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email
),
{
Quantity: varQuantity
}
),
Collect(
Licence_Shopping_Cart,
{
Name: ThisItem.Title,
Quantity: Int(TextInput2.Text),
MitarbeiterName: ComboBox_Search_Employee_Software_1.Selected.DisplayName,
MitarbeiterMail: ComboBox_Search_Employee_Software_1.Selected.Email
}
)
)
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
hello @v-jefferni ,
thanks for the help. I tried it out. Had to Adjust a few things. To make it without throwing an error
/* Here */ UpdateContext({varQuantity: 1});
If(
CountIf(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterName = ComboBox_Search_Employee_Software_1.Selected.DisplayName
) > 0,
UpdateContext(
{
varQuantity: LookUp(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email,
Quantity
) + Int(TextInput2.Text)
}
);
Update(
/*Here this*/ Licence_Shopping_Cart,
LookUp(
Licence_Shopping_Cart,
Name = ThisItem.Title && MitarbeiterMail = ComboBox_Search_Employee_Software_1.Selected.Email
),
{Quantity: varQuantity}
),
Collect(
Licence_Shopping_Cart,
{
Name: ThisItem.Title,
Quantity: Int(TextInput2.Text),
MitarbeiterName: ComboBox_Search_Employee_Software_1.Selected.DisplayName,
MitarbeiterMail: ComboBox_Search_Employee_Software_1.Selected.Email
}
)
)
Now i have the problem, as soon as more than 2 Licence are in, a new item is generated for the next license ( And the name turns blank with the second Licence (fixable)
User | Count |
---|---|
258 | |
111 | |
95 | |
48 | |
41 |