How to print all values with same key in one row? - angularjs

I am new in AngularJS. I wanted to ask how to print all the values with similar key in a row, then another set of values with similar key in another row. For eg. I have to print employees name with similar age in one row etc..Can anybody give me a solution?

It's better to have data as array for ng-repeat.
Now, pre process that data in controller or service to group them based on the criteria ( same age in your case ) and then simply ng-repeat.

Related

Query of Arrays in Salesforce

I need to do 1 of two things (I believe):
1- Get a Custom Object ID so I can query it directly
2- Get a list of values of a specific field within the Object entries.
Ultimate End goal:
Add and modify rows in my custom object via external API. However to do this I need to check and make sure my new entry/row does not already exist.
What I have:
I have a custom object (called Customer_Arrays__c). It is a table that I can add new rows to (I will call entrys). Each entry has 6 or 7 fields. 1 of these fields is called (external_ID__c). This is the field I utilize to match to new incoming data to see if the entry already exists, or if it needs to add a new row to my table. This Customer_Arrays__c is a child to my opportunity I believe – it is part of every opportunity and each line item I add has a field defaulted to the opportunity.
Help I need:
1- How do I query the value of my Cutomer_Arrays__c based upon an opportunity ID?
2- How do I query a list of values in my (external_ID__c) based upon an opportunity ID?
Thanks for your help! I have read half a dozen+ posts on similar topics and am missing something. Examples of some Past try's that failed:
Select external_ID__c,FROM Custom_Arrays__c WHERE Opportunity='00...'
Select Id (Select ID, Custom_Arrays__c from Custom_Arrays__c) from Opportunity where id ='00...'
List FROM Custom_Arrays__c WHERE Opportunity='00...'
Select Id, external_ID__c, (Select external_ID__c FROM Custom_Arrays__c) WHERE Opportunity__c='00...'
Thanks again!
Only you know how did you name the lookup field (foreign key) from arrays to Opportunity. You'll need to check in setup, next to where external_ID__c is. Since it's a custom field (gets __c at the end), my guess is you went with default.
Try
SELECT Id, Name, External_Id__c
FROM Customer_Arrays__c
WHERE Opportunity__c = '006...'
Thank you eyescream, that got me almost all the way there. Turns out I also needed a __r for the parent child relationship.
Here is a snip out of my final code that works - I think it covers everything:
SELECT Field1__c, Opportunity__r.Id, Opportunity__r.Opportunity__c,
FROM Customer_Arrays__c
WHERE Opportunity__r.Id = '006...'.
Thank you so very much!!!

Is it possible to nest values based on key column in AppSheet?

I have a table connected to AppSheet that has a column called "Names" there are many values that have the same name with different information. Is there anyway in AppSheet to have the user tap on one name and have all of the values show up that have the same Customer name. Essentially grouping.
I know there is a community on Google Plus for AppSheet but it doesn't seem very active my question has been sitting on the site for weeks. If anyone needs more clarification please ask.
Not very clear what you are trying to achieve, but you can correct me if I'm wrong.
You want in the Inline view of any given Customer, to have a list of referenced values.
You can do this with a SELECT() function. In Data > Columns > + "Virtual column"
In the "App formula" input add your function.
For example: SELECT( myTable[myColumn], [Name] = [_THISROW].[Name])
What this does:
List all values from column named "myColumn" in table "myTable"
where "Name" has the same "Name" as this row,
https://help.appsheet.com/expressions/functions/select
If you want to list not only values but a list of referenced rows from another table, you should use REF_ROWS.
For example REF_ROWS("myOrdersTable", "orderCustomer")
What this does: list all rows from table named "myOrdersTable" where column named "orderCustomer" has the same value as the unique KEY of this row.
REF_ROW virtual columns are generated automatically when you give a "REF" type to any column. In this example if you go to Data > Columns > "myOrdersTable" and change the type of "orderCustomer" to "REF" with "ReferencedTableName" to "myCustumerTable", a virtual column with list of referenced rows will be generated in "myCustumerTable" table after you save.
https://help.appsheet.com/data/references/references-between-tables

Laravel show records as flat array or single record

I have 2 column in my table setting
with the following values
KEY VALUE
company ABC
phone 14344
address Somerset City
I need to display this like a single record or a flatten
array in the view/blade page
something like
{{$sett->company}}
{{$sett->phone}}
or an array with lookup
{{$myarray('company')}}
{{$myarray('phone')}}
The idea is if I add another settings like contact us email address
for my website I don't want to add another column.
I know this is achievable in controller by creating different variable
and executing different query but I'm kind of looking for some options here.
Thanks for the help really appreciated.
You can use $settings->pluck('value', 'key') to get your result. Read more here: https://laravel.com/docs/5.4/collections#method-pluck

How to Get Last Update id in Cake PHP

I want to update set of Records, so iam using following code and then i need update the updated row id to another table, so i want to Last Updated Row ID
$this->mymodel->updateAll(array('field1'=>0),array('field5'=>0));
In order to get the ID of the last row, you can simply use this getID function:
$this->(Model Name)->getID()
Check out the following reference for more relevant functions: http://book.cakephp.org/2.0/en/models/additional-methods-and-properties.html
Peace! xD :)

Table with dummy row (ID 0) and auto increment index

Is it legal/okay to create a row with ID '0' and AFTER that set auto increment of that ID column to (1, 1)?
Why do I ask this?
I have a table Products with columns ID and Name. I want to show all Products inside my application in a ComboBox. Users can select a product but the default entry should not be 'Product 1' but something like '(Nothing selected)'. Is it okay to create a 'dummy row' with 'ID = 0' and Name = '(Nothing selected)' in database so the application will automatically display it as default selected item?
I think the better solution is to programmatically add a please select option and validate against it, assuming you don't really want users to have this selected? I guess in theory what you've proposed should be OK though? You'd have to be careful retrieving the values in order of their Id though, if you ordered them by name you'd have to ensure you pulled Id = 0 first then ordered the rest which feels like more work then programmatically adding the option where needed to me.
If your users can have nothing selected then programmatically add the nothing selected option and handle saving no value if it is selected. Otherwise you're saving data that represents no data really which could be deemed a waste of memory.

Resources