How to check if a SDT collection is empty - grid

I'm having this grid to insert records into the database . How can I check if there isn't any information on the grid when insert into the database when clicking 'Registration', like this . This grid is based on a SDT collection.

To check if an SDT collection is empty, use the count property.
For example, if your collection is &SdtProducts, use &SdtProducts.Count to get the number of items in the collection. The count will return zero if there are no items in the collection.
Although you don't describe your example in detail, it looks like you could also check against sum equals zero.

Related

Store a manipulated collection in Power Apps

(1) In my Canvas App I create a collection like this:
Collect(colShoppingBasket; {Category: varCategoryTitle ; Supplier: lblSupplier.Text ; ProductNumber: lblProductNumber.Text });;
It works - I get a collection. And whenever I push my "Add to shopping basket" button, an item are added to my collection.
(2) Now I want to sort the collection and then use the sorted output for other things.
This function sorts it by supplier. No problems here:
Sort(colShoppingBasket; Supplier)
(3) Then I want to display the SORTED version of the collection in various scenarios. And this is where the issue is. Because all I can do is manipulate a DISPLAY of the collection "colShoppingBasket" - (unsorted).
(4) What would be really nice would be the option to create and store a manipulated copy of the original collection. And the display that whereever I needed. Sort of:
Collect(colShoppingBasketSORTED; { Sort(colShoppingBasket; supplier) });; <--- p.s. I know this is not a working function
You could use the following:
ClearCollect(colShoppingBasketSorted, Sort(colShoppingBasket, Supplier))
Note that it is without the { }
This will Clear and Collect the whole colShoppingBasket sorted.
If you want to store the table in a single row in a collection, you can use
ClearCollect(colShoppingBasketSortedAlternative, {SingleRow: Sort(colShoppingBasket, Supplier)})
I wouldn't recommend this though because if you want to use the Sorted values you'd have to do something like this:
First(colShoppingBasketSortedAlternative).SingleRow -> this returns the first records of the colShoppingBasketSortedAlternative then gets the content of the SingleRow column, which in this case is a Collection
Note: You will need to replace the , with ; to work on your case

Populate Multi-Select widget names from related values

I have a multi-select widget bound to a table that only contains relations. I want to use the related values for each record to populate the multi-select name.
Parent-Table
- Child-Table-One
- Child-Table-Two
No matter which way I try using the multi-select name paths, only the first record name in the multi-select gets populated with the related value from the related child table, the others just display the record ID of the Parent Table.
Do I need to use a function somehow to iterate through all records to get the related values for every record?
Binding to the Relation should get you a list of records. Assuming you're trying to get list of the display names, this should work:
(#datasource.item.Child1).concat(Array.from(#datasource.item.Child2))

AWSSDK - DynamoDB delete items by term and add automatic create date attribute

I want to know if there is option to add in creation table automatic attribute or something like this that will save the create date of each "row" in table . I search on amazon documentation and didn't found something like this , I am new with dynamoDB ,and I do not have a lot of knowledge..
So , It's possible ?
Another issue - I want delete items (use on DeleteItemRequest) by filter on the date attribute - it's possible ?
It is not possible to add an attribute on each item automatically. What we do is for each element we want to have this we add a String called createdTime and populate it with a UTC milliseconds string.
When you delete you must have a full primary key (hash / hash+range) of the item you wish to delete. So in order to do that you either Query or Scan with a filter, to get the items you want to delete, and then run a delete item request (or batch) on them to remove them.

Choosing from multiple query results to display in a single form

I have a form that submits parameters to a query, then opens the resulting record in another form. The problem is, whenever there is more than one record it automatically puts the first one into the from without any kind of option to choose the record I want. I have a macro set up on the search button on the first form that submits the parameters to the query and then displays it in the second form, I've tried to set up another macro in between the two, but I don't know if it's possible to set up the expression creator to check the number of rows resulting from a query. Is it possible to modify the query to create a prompt to choose which record I want? Or should I change something else?
This is the query:(automatically created by access)
SELECT CHILD.CHILD_L_NAME, CHILD.CHILD_F_NAME, CHILD.DOB, CHILD.GENDER, CHILD.DAYS_IN_CARE,
CHILD.HOURS_PER_DAY, CHILD.ENROLLMENT_DATE, CHILD.CHILD_ADDRESS, CHILD.CHILD_CITY,
CHILD.CHILD_ZIP, CHILD.CHILD_STATE, CHILD.CLASSROOM, CHILD.SNACK, CHILD.LAST_UPDATED, CHILD.CIN
FROM CHILD
WHERE (((CHILD.CHILD_L_NAME)=[Forms]![Search]![L_NAME]) AND
((CHILD.CHILD_F_NAME)=[Forms]![Search]![F_NAME])) OR
(((CHILD.CHILD_L_NAME)=[Forms]![Search]![L_NAME]) AND
((CHILD.DOB)=[Forms]![Search]![DOB])) OR
(((CHILD.DOB)=[Forms]![Search]![DOB])) OR
(((CHILD.CHILD_L_NAME)=[Forms]![Search]![L_NAME]));
If I understood well your problem and you use VBA it's quite easy to do.
You can create a reduced query based on the query you're creating with the button. This new query should include all and only the fields that allows you to discriminate beetwen the records to show in the 2nd form.
For instance it could include LastName, FirstName and classroom to select between children with same full name.
You can count the number of records of this 2nd query and if greater than 1 it means that you have more than one children to show.
So you can use this 2nd query to populate a combo-box or a listbox for selecting the record you really want to show.
When number of records is 1 you can simply skip the listbox population using an if statement on recordcount.
Next step is opening the form with the selected (or unique) record.
Bye

how get item from each cell in grid

I have form with grid. I defined dataStore with 2 columns (text and checkBox). Grid.store = defined dataStore. Second column is editable (you can change selection on each checkBox). I have some button, and when I click it, I want to get info about each cell. Example if have gird:
Name1 true
Name2 false
I want get info col[0].row[0] is equal 'Name1', col[0].row[1] is equal 'Name2'.
I try iterate on dataStore but it has only value which I put them by hand. The value which was changed on grid by clicking on checkBox didn't save in dataStore.. My question is how to iterate on grid, how get info about each cell.
To iterate across a store in Ext3, you can use dataStore.each()
Supply it an anonymous function and the parameter it receives will be the current record in the store. The data in the current record can be read by using record_var.get(field_name).
So, for example:
var dataStore = myGrid.getStore();
dataStore.each(function(rec){
alert(rec.get(field1));
}

Resources