Generate a link if a product number begins with XYZ - eval

I'm not a developer but we have it set up here so that when a customer orders certain products in Linnworks, a link gets included in their e-mail receipt.
This currently works.
EVAL{BEGIN}IIF["[{ORDERITEMS.SKU}]"="XYZ1234", "Click here for <a href='HTTP://LINK'> guide</a>", ""]{END}
It gives a link if the item SKU perfectly matches, but what do I write if I want it to match if the sku STARTS WITH "XYZ" and allow for any combination of numbers after that?
Thanks.

Related

what am i supposed to do in this situation?

so recently my principal is having me create a database for a tardy system recently what i've done is set up a google form where the student id can be enter through a num pad and put into a google sheet where ive setup 2 sheets one where it shows the student name and how many tardies they have and then the other is the google form responses, each tardies cell in the other sheet has the formula: =COUNTIF('Form Responses'!B:B,"") which essentialy checks the number of times a certain student id pops up, by ferpa i am not legally allowed access to the student id's is there any possible way i can maked it when a person enters their student id it adds/creates a new formula for the tardies cells to check through the entire list without a duplication or error code?
i have tried the =COUNTIF('Form Responses'!B:B,"") formula but that would make where my principal would have to edit a thousand lines of formula
Depending on the exact setup of your sheets, you can use a formula like this, guessing that the students' IDs are in A column:
=BYROW(A2:A,LAMBDA(each,IF(each="","",COUNTIF('Form Responses'!B:B,each))))
That would set a formula will drag all the column automatically.
Or, instead of having a list of IDs you can set a QUERY that will find all the ID values in the responses and their count:
=QUERY('Form Responses'!B:B,"SELECT B,Count(B) where B is not null group by B")

How do I update a field in the list Lightning component?

my code contains two lightning: datatable where I pass two lists respectively. The first list "prodList" I need to show the products in the first lightning: datatable the second checks my cart. Having said that I have a question, when I go to select a product in the table as seen in the picture, a popup appears with a lightning in it: input which I need to make the user enter the desired quantity of that product. My list contains an "Available Quantity" field, when I go to select a product and enter the quantity you want it makes me a check where I subtract the quantity chosen by the user from the "Available quantity", how do I update the list and automatically check the updated value in the Available Quantity?

In MongoDB/React what is the best practice for filtering data?

I came here today with a theoretical question. (hint: it will be long and tough, but to fully understand the problem I think I have to write every important detail. If you read it to the end huge thanks for you, you're not the hero we deserved but the hero we needed)
Story time: I'm currently building an online shop from 0. It has the same principles as an ebay: users can create advertisment for their used products. The problem is that I want to create a filtering feautre.
What is my MongoDB data structure?
My page has products with different attributes, by this I mean that the products have varying categories and values. To imagine here is an example
Product A:
Creator:User1
Category:Car
Type:BMW
Color:Red
Product B:
Creator:UserB
Category:Electronics
Type:Phone
Producer:Apple
To be more complex each user can define maximum 3 more extra category and value for each product. So for example User1 adds 2 new category and the final product will be:
Product A:
Creator:User1
Category:Car
Type:BMW
Color:Red
Number of seats:4
Fuel type: Gasoline
Because of the above mentioned when a user adds a new product there will be two type of categories: the static ones which are predefined by me(Category,Type,Color -> in car's case) and the dynamic ones which the user adds (Number of seats, Fuel Type or anything else).
Overall: My final data structure in mongoDB is not static, since there are some added categories. Because of this I have a Product collection and each document looks like the above mentioned example
How are the items shown?
I have a main page. When I populate it I make a call with $skip and a $limit attribute set to 8, so for the first time I only query 8 products. If a user clicks on a Load More button it will load another 8 product and so on.
FINALLY: My actual question ...
So at this point I guess you understand everything related to the business logic so it's time for my question: if I want to filter these dynamic products, but i don't know what is the best practice for it?
My idea:
First create a mongoDB collection named Categories. Each main category will be a document in it and we will store static and dynamic categories and values
ex:
category:car
predefined:[{type:[BMW,Mustang,Ferrari]},{color:[red,green,blue]}]
userdefiend:[{number of seats:[2,4,5,6]},{fuel type:[Gasoline,Air,Diesel]}]
We load the the values in the main page if a user clicks a specific value ex:BMW we set a limit to 8 and go through on our Product collection and get the 8 items which has a Type:BMW. If he selects another option ex: color:Red we loop again through the collection but now with two criteria: Type:BMW and color:Red.
Idea2: Create a Category collection again with this structure
categoryType:predefined
mainCategory:Car
categoryName:Type
BMW:[prodA, prodC,prodD]
Ferrari:[prodD,prodE]
...values:products which contains
categoryType:userdefined
mainCategory:Car
categoryName:Number of seats
4:[prodA, prodD],
5:[prodE]
If a user selects from Type category the BMW we load the products from the BMW fields [prodA,prodC,prodD]. If the user selects Number of seat category with a value 4 we load the [prodA, prodD] and on the webpage we use a filter with our actual products so it remains only [prodA,prodD]. And from our actual list we use findById for the specific products.
I think that these are not the best options from any perspective, but I am really confused.
What do you guys think how should I structure my categories/products to have an efficent read/write/update complexity?
Anyways thank you for reading this and if you made it until here I'm curious about your idea. Have a nice day
UPDATE:
The filtering functionality
To don't have any confusion this is my filtering idea: When a user selects a main category for example Car or Electronics I want to show only the relevant filtering categories and options. Filtering categories in Car's case are Type and Color.
I want these filtering options to have pre-poupulated options. By this I mean, that if a filtering category is Type, and there are 2 Products which has Type:BMW and Type:Ferrari I want to show these values as options for filtering. And I don't want to hardcode these options, for example I hardcoded Type:Laborghini and I have no products with type Laborghini.
By the end if a user clicks to a Type:BMW I will filter all of my products based on that criteria.
My filtering side menu will look like this:
Type: BMW,Ferrari (these values exists in my database)
Color:Red,Black,Grey,Yellow
And for user-added categories I will build a searchbar, if a user selects a userdefiened category I want to add to the filtering categories so the overall look would look like this:
Type: BMW,Ferrari (these values exists in my database)
Color:Red,Black,Grey,Yellow
Number of seats:4,6,7 (number of seats category is added by user, 4,6,7 are the existing values to this category)
You could structure Your data like having a generic Products collection. Having both
Product A:
Creator:User1
Category:Car
Type:BMW
Color:Red
Product B:
Creator:UserB
Category:Electronics
Type:Phone
Producer:Apple
rows. Whenever you show the filter component, you can select the available categories by using an Aggregate (https://stackoverflow.com/a/43570730/1859959)
This would generate search boxes like "Creator", "Category", "Type", "Color", "Producer".
The data itself would be as generic as possible.
When the user wants to add a new product, it starts out from a template, like "Car" or "Electronics". The Templates collection gives him the initial values, which should be included. So it would be like:
{Car: [{type:[BMW,Mustang,Ferrari]},{color:[red,green,blue]}],
Electronics: ... }
Selecting a Car would generate the "type" and "color" input boxes. Saving the form would insert the new row into Products.

I want to Create a Crystal Report of Paid Sales Invoices

When a Sales invoice is paid it is matched against the receipt.
A Sales invoice can also be matched against a credit note but there is no distinguishing flag.
I want the final report to only show the Paid invoices.
I am currently Grouping by Customer, then Matching Letter, then document, so at this level you can see if the match is with a receipt or with credit notes.
I output the Group footer of the document giving me a list of documents, which for a customer payment will start with the Receipt, followed by one or more invoices totaling the value of the receipt:
GF4 Customer A Match BC REC101009798 GBP240.00
GF4 Customer A Match BC INV101059389 ‘new field’ GBP120.00
GF4 Customer A Match BC INV101059390 ‘new field’ GBP120.00
If the matching is as a result of a customer payment, the Receipt will always be on the first line in the group output.
How do I create a ’new field’ on the Invoice lines that will say “Paid” , it doesn’t matter if the new field also appears on the Receipt line?
I have tried to use a formula on the group footer referencing the document type but of course when the document type changes, so does the result of the formula.
Having a success on the first line I have been concentrating on trying to copy the result on to the successive lines so thought a fresh pair of eyes might help.
Many thanks
Use Subreport. You can pass inv no or doc type to subreport and get status . Put subreport in invoice line.
Thank you Pals, I have solved this with a colleague.
We revised the formula on the Group Footer. First we created a formula that assigned a 1 to a Receipt and 0 to all other docments: IF {GACCDUDATE.TYP_0} = "REC01" THEN 1 ELSE 0. Next we created a SUM formula: IF Sum({#rowIsPaid}, {GACCENTRYD.MTC_0}) > 0 THEN "Paid"
and put this on the Group footer.

Salesforce - Email Template Usage

Is there a quick method of reporting the usage of individual email templates within Salesforce on a Visualforce page? The usage data is already calculated and posted on the individual email templates page. I just need a method to query that data and report the usage for each email template on a summary page.
thanks
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_emailtemplate.htm
TimesUsed: Number of times this template has been used.
SELECT Id, Name, Subject, IsActive, TemplateType, LastUsedDate, TimesUsed
FROM EmailTemplate
WHERE TimesUsed > 0
ORDER BY TimesUsed DESC
LIMIT 10
Try this out too
SELECT Folder.Name, SUM(TimesUsed)
FROM EmailTemplate
WHERE IsActive = true
GROUP BY ROLLUP(Folder.Name)
(there will be 2 rows with blank folder name. First one will correspond to "unfiled public templates", second one will be a grand total row created because the ROLLUP function was used)

Resources