How to fetch certain column data from datasource? - google-app-maker

I want to fetch the specified column from a data source(i.e. exclude certain columns) because even I don't show the data in UI, the data is loaded. (it is visible from Network tabs in Browser DevTools).
So far, I found the automatic data load and query builder/ query script provide the filters and sorting of the data but loads all the columns.
I have tried record owner security and role based security but this will make the data inaccessible to some users.

You can try creating a Calculated SQL Model to limit columns being pulled.
Let's take an example where you have a Student model with Name and City as the only two fields. You can add a new Calculated SQL with this SQL query and only Name column would be pulled.
SELECT Name FROM Student
Please refer to the official guide here. Feel free to comment if you want some clarification!
Hope this helps.

Related

Find User IDs not on OPRDEFN in PeopleSoft FIN

Our former security admin team off-boarded terminated users by deleting their user profiles from the system. We have changed that policy but there is potential for duplicates. I am attempting to find user ids on the various module tables that are not on the OPRDEFN but having no luck.
I would like to query the major tables to return a list of all user ids to compare to the current OPRDEFN. From there, I can either have them added or create a reference list the admins to use prior to creating a new user id.
Does anyone have any tips or already written SQL? I am not the best SQL writer, I've tried several different things but nothings works.
Any help would be greatly appreciated.
Here you have a list of tables using the OPRID field. I have already formatted it in a way you can just run the result to get the Oprids.
Also, consider other columns like OPERATOR
SELECT 'SELECT DISTINCT OPRID FROM PS_'||RECNAME||';' FROM PSRECDEFN WHERE RECTYPE=0
AND RECNAME IN
(SELECT RECNAME FROM PSRECFIELD WHERE FIELDNAME IN ('OPRID','OPERATOR'))
AND RECNAME NOT LIKE '%AET'
AND RECNAME NOT LIKE '%TMP'
Also, you may just look at PSACCESSLOG, it will show you when someone access, so you may save time by querying it only

Adding properties to output of current_principal_details() in Azure Data Explorer

I am implementing Row Level Security in Azure Data Explorer, I am using
current_principal_details()
To get information about the user but how can I add the names of the groups or something that the user is part of?
I cannot use
current_principal_is_member_of()
Since I will have over 6000 groups and the RLS query will be just too long so my idea is to add groups or roles or something to the user that I can see using
current_principal_details()
And the parse them and use that as input to the RLS query
I am using the following KUSTO to get the info of the user
print d=current_principal_details()
I just need to know how to add properties to the output and use them as input to RLS query

A few questions regarding importing a manually created data entity

I used the data entity creation wizard and selected Reqplan table as the main data source, then I manually added ReqPlanVersion, ReqPO, ReqTrans table as additional data sources and created the relationships below.
As for the data entities fields I manually dragged a subsets of fields from the three manually added tables.
However when I try to import the data and add file, I receive the following issue:
Q1. In the past for some other entities I have changed ‘Allow Edit on Create’ from ‘Auto’ to ‘YES’ on these fields and it has worked but I am not sure if it’s the only way or is it following best practice? Also what is the determining factor for a field to be editable or not during import since they are all on AUTO?
When I try to map source to staging manually by drawing the mapping lines I get below issue:
Q2. What is going on with the configuration key? Is it because I manually dragged the fields from the additional data sources but not using the data entity creation wizard?
Lastly I been getting below issue:
Q3: Is there a way to find out which unique key it is referring to? Is it talking about the EntityKey in my Data Entity or Indexes in staging table? In either case there are more than one so I am not sure what it is referring to?
Thanks in advance.
Response from the community forum:
1) Check allowEdit property on table itself, so if it is "No" there then auto means "No". If you want to update them through data entity you will have to force them to "Yes"
2) It's not connected to manual addition, it just says that tables used in the entity has configuration key disabled, so you cannot export or import data into them, however, these tables could be added by wizard or manually, it does not matter. Also, Configuration key could be on fields as well or on EDT that these fields use, check them as well.
3) Entity has Key node and there and there you have key generated by wizard for you. It is used by framework to understand if record should be updated or created, if it does not work for you, change it on the data entity and regenerate staging. You need to refresh staging because error you get is SQL error, at this stage SSIS transfers data from a file into a staging table and data could not be copied because of index vialotion, so check staging table index and see if your file has any duplicates.

How to sort a table for which its datasource is a relation

I have a Page with a Table for which its datasource is a relation and needs to be sorted based on fields from another model:
Page
Datasource = Indicators
Table
Datasource = Indicators [one] : MetadataText [many] (relation)
The Table needs to be sorted based on a field from another Model called MetadataField, which has a one to many relation with MetadataText.
I have the datasource of MetadataField sorted. But the content in the Table appears in random order. When I first access the application, the Table is sorted by the order that the records were loaded. After view some records, the sorting of the records changes and keeps changing.
I am using Google Drive tables.
You can easily sort related records by one of the fields that belong to the related record itself, but only once (you'll received those records sorted from server).
But it seems, that you want to sort related records by their related record. App Maker will not be your friend in this case... but javascript will be! Since App Maker loads all related records you can safely sort them on client using javascript:
indicatorsDatasource.load(function() {
indicatorsDatasource.items.forEach(function(indicator) {
indicator.MetadataTexts.sort(function(a, b) {
return /* here goes your sorting logic */;
});
});
});
It will work in O(n * m * log(m)) in case you have n Indicators on the page and every indicator has m associated MetadataTexts. If you want to let users to sort related records by clicking table's header, you'll need to implement that logic on your own. So... all this hassle leads us to alternative solution! What if we decouple related records and introduce separated datasource for them? Having that you'll be able to use full power of App Maker's tables (sorting/paging) with almost no effort. You can take a look at implementation sample in Project Tracker template ViewProject page.

How to include a relation of a relation in an AppMaker table field?

I have three data models, Partner, Client and SOW, where Client is a one-to-many relation to SOW, and Partner is a one-to-many relation to Client. I would like to include Partner Name as a column in a table displaying SOWs. Is there a way to do this with a datasource query script? Or a different approach altogether?
I was able to add a label to the SOW table row that is data bound to the Partner name via relation, but I have yet to tackle sorting and filtering by Partner, and this method appears to fetch Partner real-time after the table loads. I am currently using Drive Tables as my datasource, but am open to switching to Cloud SQL.
You can manually add header and 'cell'(one more label in list row).
Binding for the label in the header:
#models.Partner.fields.Name.displayName
Binding for the label in the list row:
#datasource.item.Client.Partner.Name
And don't forget to add both Client and Client.Partner relations to Prefetch, it should make your page load/render faster.
Useful tip:
You can copy/paste existing table labels to duplicate all original margins/paddings/styles and make them look/behave in the same way as all other labels within the table. In this case you'll need just to adjust your bindings and maybe rename some things.
Note:
Most likely you'll not be able to sort your table by relation of relation, but feel free to try(checkout onClick event handlers of labels in the table header).

Resources