I have somewhat of a novice question that seems to be proving difficult. I use a rest-API route to create custom posts for a WordPress site. Everything works perfectly except for a field that receives a list of values. e.g. on a page for teachers, I am using the multi combo box to select multiple values for their qualifications e.g. Ph.D., MSc, NCE. Adding one value works but if a teacher has more than 1 value the page variable doesn’t take it and it the page on the website only displays one value I’m guessing they need to be saved in an array or something so I’m looking for guidance on how to do this. Thank you for your assistance in advance.
Not 100% but try with a list of objects.
List [
object {qualification}
]
So that you get a list of results like that in your list:
{"qualification": Ph.D}, {"qualification": MSc},...
I tried this, still nothing:
So essentially this is the result i am expecting:
List [
1021,
1022,
1023,
2950
]
So keep it as list of text.
Can you show us the data resource?
This component has proven to be challenging to tame for me. (much like most of the components on AG actually - my no code mind no being compatible with the appgyver way they work…).
Can you show us how you bind the data from this component to the pageVar?
Here is the config for the multi combo box
The list options (unlike the drop down component this only allows you add the label so there is no option for value so I had to use a condition in the set page variable to assign values to labels):
The logic flow
and the assigned value:
The pb is here. You’re working with index 0 so only one value. You need to map your data with the MAP function. When you open the binding, you have options to bind with variables, formulas and mapping. Try that one.
I’m at the physical therapist now so can’t help better. Still no clue abt your situation but it’s approachable and I like to help as it forces me to think and subsequently learn and a few kind souls have helped me a lot here so I’m trying to return the favor to the community.
Thanks for this, i’ll try this out. Also if there is an alternative way of selecting multiple values without using the multibox combo I would love to explore that to avoid this complication. I’ll let you know how it goes.
Can you hover over the i icon of the list of options field to check what data type it requires? List of text or list of objects?
Sorry for the late reply had to step away. So on hovering of the list of options, it says “list of objects”.
Interestingly after doing the mapping I’ve been able to get this to work on a separate screen and it submits successfully:
but for some reason, this one throws:
throws this error when I try to submit:
When your multi combo box (or any other components) returns a list of objects, then your schema must respect that and have the same list of objects for the qualifications.
I think your formulas are wrong.
Use this option that will guide you to build the right mapping formula.
Been battling with the mapping section, not sure I’m using it right but I still have the issue of type string giving an error even after I changed it to a string value. If I leave it empty it still gives that error even though it isn’t a compulsory field.
This is how a mapping setup should look like
- Pay attention to the data source.
- You would drag the “available fields” from the left to the right.
Thanks for your last post, i was down with the flu hence my absence. So getting back to this i think the only issue i have with the mapping is the multi combo only has one property for the label so there’s nowhere to map the numerical value let alone add it, as opposed to the drop-down component that has two properties for the label and value. I found a solution that works in javascript and would want to know how to change this to a formula in appgyver:
if (item.token === “Pre Primary”) {
pageVars.school_category.push(1100);
} else if (item.token === “Primary”) {
pageVars.school_category.push(1052);
} else if (item.token === “Junior Secondary”) {
pageVars.school_category.push(1054);
} else if (item.token === “Senior Secondary”) {
pageVars.school_category.push(1053);
} else {
pageVars.school_category.push(“”);
}
the item.tokens are the labels for the list in the multibox so on click they will pass the number value as opposed to the name. The item.value will be replace with “self.selectedTokenList[0]”