Displaying SharePoint List items using Tabs in PowerApps Gallery - sharepoint

Per this brilliant instructional video https://www.youtube.com/watch?v=1o2L0DADzKQ by Reza Dorrani I created collection colTabs to display different SharePoint List items in a PowerApps gallery. The OnStart property for App is this collection colTabs (smaller portion shown here):
ClearCollect(
colTabs,
{
ID: 1,
Name: "All States",
},
{
ID: 2,
Name: "East Coast",
},
{
ID: 3,
Name: "West Coast",
}
);
The "Name" from above are choice values from a SharePoint List regionsUSA.
So far in the main gallery I have the Items property as:
If(varTabSelected = 1, regionsUSA)
...and that is working fine displaying all items in the first tab. How do I expand the above If statement so that from the same SP List, if varTabSelected = 2, then only East Coast items are displayed, if varTabSelected = 3 only West Coast items are displayed and so on? Somehow I am having trouble pulling the choice items from the List so I am stuck.
Thank you.

Why write a dynamic filter statement instead?
Filter(regionsUSA,RegionName=LookUp(colTabs,varTabSelected=ID,Name))
If it gets a delegation warning, I'd try:
Switch(varTabSelected,1,Filter(regionsUSA, RegionName="All regions"),2,Filter...)
You can also achieve this using If, but it's even more typing:
If(varTabSelected=1,Filter(...), varTabSelected=2, Filter(...),...)

Related

Acumatica Mobile - Is it possible to make a Container with a value of a field displayed together with the container name?

I'm new to Acumatica and I was wondering if this is possible to make in Acumatica Mobile App.
I have created 3 custom fields in the Customer screen where it can calculate the total amount of AR Invoices, Hold Checks, and Voided Payments of the customer.
I want it to be displayed in mobile app just like the images I have attached.
The first image I have attached shows where the Customers list and it should display the Name of the Customer together with the TotalARBalance field. The second image shows if you select a specific Customer it will display its total amount of TotalARBalance, TotalHoldBalance, and TotalVoidedBalance with its Container Name accordingly.
This is the Customers screen in Web App:
This is my code for the Customers screen:
add screen AR303000 {
add container "CustomerSummary" {
add field "CustomerID"
add field "Status" {
forceIsDisabled = True
}
}
add container "ARInvoice" {
add field "RefNbr"
add field "Status"
add field "Balance"
add field "DueDate"
}
add container "HoldChecks" {
add field "PaymentRefNbr"
add field "DateOfHold"
add field "PaymentAmount"
add field "ExtensionDate"
}
add container "VoidedPayments" {
add field "ReferenceNbr"
add field "VoidStatus"
add field "PaymentAmount"
add field "DateVoided"
}
}
I tried to look in the Documentation for Mobile Framework Guide but I found nothing similar to what I want to make
I think you have two questions here:
Adding the TotalARBalance custom field to the Customer List Screen (AR3030PL).
-Make sure the TotalARBalance custom field is visible in the UI web screen.
-Get the proper name to be used in the MSDL Code (Mobile customization) for this field. In order to do this you must check the WSDL Schema for that screen (AR3030PL).
-Then make sure that you set the proper value to the fieldsToShow property for your Result container, see below:
add screen AR3030PL {
add container "Result" {
fieldsToShow = 5
containerActionsToExpand = 2
add field "Field1"
add field "Field2"
add field "Field3"
add field "Field4"
add field "TotalARBalance"
add containerAction "editDetail" {
behavior = Open
redirect = True
}
add containerAction "Insert" {
icon = "system://Plus"
behavior = Create
redirect = True
}
}
}
About the container with custom field's values.
Out of the box I don't think the Mobile app could render the exact same design.
You could create a group with the same names as you showed in your image but the field's value won't be displayed when the group is collapse. However, if the user uncolpases the group then they will be able to see the custom field's value for that group.
See below quick snippet for the AR Invoice group in your image:
................
add group "ARInvoiceGroup" {
displayName = "AR Invoice"
collapsable = True
collapsed = True
add field "TotalARBalance"
}
#add other two groups here
........
You can review more information about groups on this help article below:
https://help.acumatica.com/(W(1))/Help?ScreenId=ShowWiki&pageid=37c0e79c-e89e-4e41-8b05-ca3df5e053f1

How can I get PowerApps to see SharePoint Online multi-select Choice field values?

I have a PowerApps form connected to a SharePoint Online list. My SharePoint list titled "Log" has a multi-select Choice column named "Service", which appears in PowerApps as a combo-box. The user can select 1 or more "Services" from this combo-box. Based on the selection of services, a number of related "Agencies" should appear in a Gallery on the form. The Agencies are defined against each Service in the Services list.
Log List:
Services: Multi-select lookup
Service List:
Title
Agency (Multi-select Choice, all possible agencies for this Service)
While I can get the selected services from the combo box, the problem is that I am unable to retrieve the values from the Agency multi-select Choice field in the same list. What I have tried is to get the selected Services from the dcvServices control (into SelectedServices) and then collect the related Agency values (into AvailableAgencies) during the OnSelect of the Service dropdown:
ClearCollect(SelectedServices, Filter([#Service], Title in dcvServices.SelectedItems.Value));
ClearCollect(AvailableAgencies, SelectedServices.Agency);
When I try to hook up my Gallery control to the AvailableAgencies collection, I can't quite getthe Agency values to display. I get the following error:
Let's walk through an example, which should shed some light on this problem. If my Service list has these values:
And the services 1 and 4 are selected in the combo box:
Then the expression ClearCollect(SelectedServices, Filter(Service, Title in dcvServices.SelectedItems.Value)) will assign to the SelectedServices collections two items (Service1, Service 4), each of them having a list of agencies associated with it.
If we try to collect the agencies in a separate collection as is, with the expression ClearCollect(AvailableAgencies, SelectedServices.Agency), you will not have the individual agencies in the collection; instead, you will have two records, each of them with a collection itself:
[
Agency: [ { Value: "Agency 1" }, { Value: "Agency 2" }, { Value: "Agency 3" } ],
Agency: [ { Value: "Agency 1" }, { Value: "Agency 4" }, { Value: "Agency 7" } ]
]
And if you have this collection in a gallery, and try to display the value of the agency in a label (which requires a single text value), this won't work (as you stated):
ThisItem.Agency.Value
Because this is not a single text value, but a collection of them (for example, the first item would be the collection of agencies 1,2,3). You could show all values for that specific record using the Concat function, as shown below:
This may not be what you need; if you want all of the individual agencies that are associated with the selected services, you will need a different expression:
Clear(AvailableAgencies2);
ForAll(
SelectedServices,
Collect(AvailableAgencies2, ThisRecord.Agency.Value))
And with that you will have the agencies only in your collection:
Notice that since both service 1 and 4 were associated with the Agency 1, it appears twice. If you don't want that, you can use the Distinct function to filter any repeated values out:
Clear(AvailableAgencies2);
ForAll(
SelectedServices,
Collect(AvailableAgencies2, ThisRecord.Agency.Value));
ClearCollect(AvailableAgencies3, Distinct(AvailableAgencies2, Value))
And that should give you the list of unique agencies associated with the selected services.

NetSuite: Need to get value Of Landed Cost Category Line Field using Transaction Saved Search

I am trying to somewhat mimic NetSuite's Landed Cost feature using NetSuite's customization options (SuiteBuilder,SuiteScript etc.) and then further extend the functionality according to my requirements.
For this I need to in script, get value of "LANDED COST CATEGORY" line field of item sublist in the Transaction records (like Bill, Purchase Order etc.) using saved search.
But in a saved search I was unable to find any Column/scriptId which would give me value of LANDED COST CATEGORY line field. We ARE able to get this value using record.load().getValue() but I need this value from multiple transaction records and using this approach may cause performance issues. So, please can you tell how we can access this value using saved search.
I don't believe Netsuite exposes that field in saved searches at this time. This is the records browser in Netsuite listing all of the available search columns for Transaction searches. The internal id for that column is landedcostcategory, and that doesn't show up on the list.
However, if your goal is to get this information in SuiteScript, then you can use the 'N/query' module. Pull up one of your Purchase Orders, open the Javascript console (Ctrl+Shift+J) and try this:
require(['N/query'], (query) => {
const suiteqlQuery = `SELECT
transaction as transaction_id,
BUILTIN.DF(transaction) as transaction_name,
BUILTIN.DF(item) as item_name,
item as item_id,
landedcostcategory as landedcostcategory_id,
BUILTIN.DF(landedcostcategory) as landedcostcategory_name
FROM
transactionline
WHERE
transaction='<internal id of your PO here>'`;
const results = query.runSuiteQL({query: suiteqlQuery}).asMappedResults();
console.log(JSON.stringify(results, null, 2));
/*
Example output for results:
[
{
"transaction_id": "12345",
"transaction_name": "Purchase Order #PO123456",
"item_name": "My Favorite iPod",
"item_id": 1234,
"landedcostcategory_id": 1,
"landedcostcategory_name": "Duties & Tariffs"
}
]
*/
})

Issue of getting more items in List(Actions on google)

I am developing a shopping bot in that user will ask for the product and then i will be fetching the results from the database and the results will be more than 10 items. I know that the default items for the list is 10 items. My question here is how to add a more button at the end of the list so that i can load more of the items into the list.
for(var p=0;p<=countforchunk;p++)
{
items[p] = {
optionInfo: {
key: (p + 1).toString(),
synonyms: temparray[p],
},
title: temparray[p],
url: "https://www.google.com/imgres?imgurl=https%3A%2F%2Fcdn.pixabay.com%2Fphoto%2F2015%2F04%2F23%2F22%2F00%2Ftree-736885__340.jpg&imgrefurl=https%3A%2F%2Fpixabay.com%2Fimages%2Fsearch%2Fnature%2F&tbnid=_2JirDBiGzi3lM&vet=12ahUKEwi71YPNxdrnAhVJGbcAHVi_BdEQMygAegUIARCFAg..i&docid=Ba_eiczVaD9-zM&w=546&h=340&q=images&ved=2ahUKEwi71YPNxdrnAhVJGbcAHVi_BdEQMygAegUIARCFAg",
image: new Image({
url: imgarray1[p],
alt: imgarray1[p]
}),
}
conv.ask(new List({
title: 'Search Results',
items: items
}));
resolve();
}
Please help me out,
Thanks.
As far as I can tell - there is no technical limit of 10 items. If you put 12 items in a list, for example, it will show 12 items.
This is not, however, a very good idea. (Even 10 items is a lot, and you should be thinking about voice interaction, where you might not want to read back more than 2 or 3). So at some point you will want to think about paging anyway.
If you do, you need to implement this as another Intent and Intent Handler. You can do this by offering a suggestion chip that says "Show me more" and accepting training phrases such as "more", "what else", and "show me more" in the Intent. You can use a Context to keep track of where you are in the result list.
You have to keep track of loaded item. There is limitation of loading 30 items at a time.
When user wants more item, you have handle that voice intent and can store current page index in context and based on that you can add another 30 items by replacing existing one.
1-30 items = page 1
30-60 items = page 2 and so on.
Call an api accordingly.

How to set the defaultSelectedItems value of Multi Person combo box in Powerapps?

I would like to set the DefaultSelectedItems value with multiple person selection from a previous Gallery.
Since I'm managing multiple people, I need to create a table with the selection but since I don't know the number of records selected by the user, I cannot create it.
For example, this is the code if the user selects 2 people:
*
Table(
{
'#odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: First(Gallery1.Selected.'Crew').Claims,
Value: First(Gallery1.Selected.'Crew').DisplayName
},
{
'#odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: Last(Gallery1.Selected.'Crew').Claims,
Value: Last(Gallery1.Selected.'Crew').DisplayName
}
)
*
How can I generalize it?
Thanks!
Kindly try the formula below
ForAll(Gallery1.AllItems, Crew)
Let me know if it works or not

Resources