DBGrid and FieldName for new query field - sql-server

I have DBGrid, but not all fields I can see inside Grid (TdxDBGrid)
Was adding three new fields(red V) to qPassengers and I don't see those values.
Here is part of query for DBGrid
SELECT * from Workers left outer join Map on Workers.id = Map.WId
Workers.DecodedStreet AS Street,
Workers.DecodedHouseNumber AS StreetNum,
Workers.DecodedCity AS City,
ISNULL(Map.DecodedStreet,'') AS DStreet, // new field
ISNULL(Map.DecodedStreetNum,'') AS DStreetNum, // new field
ISNULL(Map.DecodedCity,'') AS DCity // new field
and after that with property SummaryGroups I placed new fields to my Grid,
BUT I didn't find any New fields in property FieldName, that connecting fields from query with column in DBGrid
For example So I can't find corresponding field in FieldName for column dbGridTableDStreet,
because DStreet absent in FieldName list, BUT present in the query qPassengers
*Compile and Build was done *

Your grid is using data taken from 'qPassengers' dataset. If this dataset is using persistent fields, then adding the fields to the query of the dataset is not enough to make them visible. The new fields must first be added to the persistent fields collection of the 'qPassengers' dataset. Click with your right mouse button on the 'qPassengers' dataset and open the fields editor to do so.

Related

Sort by field from jsonb column

I'm using npgsql to store data about shipments and part of table is jsonb column storing some details about shipment including details about customer who made shipment.
Table for displaying data about shipments is displaying only Customer Name and if get that record via
CustomerName = shipment.Metadata.RootElement.GetProperty("customer").GetProperty("customerName").ToString(),
Request is that I make this column sortable so I would need to sort by this property while accessing database.
Is it even possible to do it in NpgSql?
You can easily sort by a property inside a JSON document - just specify that property in your OrderBy clause:
_ = await ctx.Shipments
.OrderBy(s => s.Metadata.RootElement.GetProperty("customer").GetProperty("customerName").GetString())
.ToListAsync();
This produces the following:
SELECT s."Id", s."Metadata"
FROM "Shipments" AS s
ORDER BY s."Metadata"#>>'{customer,customerName}'
You should probably be able to make this use an index as well.

Using the same filter control for two different data sources

I have a Data Studio report containing two graphs.
Each graph is associated with a different data source. Each data source has one common field (ex: country) but shouldn't be joined together.
Currently I have to set one filter control for each data source and it is not friendly user. I want to use the same filter control (ex: country) to set the country in the 2 charts.
Is there a way to do so ?
I have a not elegant solution for that:
Have you tried create a custom field on the 2 different data sources?
go to Data Source "A" -> Add Field -> put the function CONCAT(Country_A, '') -> copy the field_ID
go to Data Source "B" -> add field -> put the function (Country_B, '') -> PASTE & OVERWRITE the field_ID.
Use on of the custom fields you have created as control filter, it will filter data in both datasources (as field_ID matches on both sources)
More details:
Let say we have Data Source "A" & "B" and the field Country is the one that we want to make 'match' across those 2 data sources. What I do is basically create a new field on one data source by using the CONCAT(fieldName, '') function. You need to create the first custom field and then you need to "SAVE" or "COPY" the field ID.
Then you go to the second data source, create a new Custom Field, following the same function CONTACT(fieldName, '') and OVERWRITE the Field_ID that Datastudio assigned by the one you have copied.
As a best practice, I always put the same Field Name on both custom fields.
Heads-up!
Be aware that if you have a list of 10 countries on data source A and a list of 20 countries on data source B, then depending on what custom field you choose to the control filter, you will have less or more options to filter. Also, this workaround does not "merge" values on both data sources. I would recommend to do a pre-processing with your data and add a data Source "C" which contains all possible countries and do the same workaround 3 times (1 custom field per data source).
Emmanuel Roulleau
its possible, filter controls work in reports with multiple data sources.
Filter control is a page-level component they effects all the charts on that page, if you want to use the same filter control to set the country in the 2 charts, Group them.
ctrl + select the charts and the filter control then Arrange -> Group
Check this embedded report https://datastudio.google.com/s/meLMNkz7ejY
So a filter control for the Analytics charts can use the Country dimension from either data source.
For more info Check This link https://support.google.com/datastudio/answer/9173975

Bound combobox items refers to different field items

I got a bounded combobox to a group name in vb.net. i can view in the drop down items of the combobox the set of GROUP NAMES. but when i do an insert or update query, i need to make the selected group name refers to the GROUP NUMBER. I don't want to store letters in the database, instead i prefer numbers. how can i do that?!
Here is my code so far :
cmd1.Parameters.AddWithValue("#group", DirectCast(Additemcombobox.SelectedItem,
DataRowView).Item("GroupName"))
Storing the group name in database is currently working well.
My question might not be well explained. Please ask me in case...
any help would be appreciated
You can show one element to the user such as the name, but use a different one for the code to identify the item using DisplayMember and ValueMember
Dim SQL = "SELECT Id, Name FROM GroupCode ORDER BY Name"
...
GrpDT = New DataTable
GrpDT.Load(cmd.ExecuteReader)
cboGroup.DataSource = GrpDT
cboGroup.DisplayMember = "Name"
cboGroup.ValueMember = "Id"
The user will only see the names, while the code can use ValueMember:
Private Sub cboGroup_SelectedValueChanged(...etc
Console.WriteLine(cboGroup.SelectedValue)
End Sub
It prints the Group ID not the name. Depending on the ORDER BY clause in the SQL and the ID, the SelectedIndex may or may not match, so respond to SelectedValueChanged event. If you use SelectedValue instead of SelectedItem you wont have to thrash about with a DataRowView item.
Note that SelectedValue is Object so you will have to cast to integer or whatever for use elsewhere.

Ability to click through salesforce reports

I want to perform the following. I have a report of summary type with four fields say name type date and status. Report is generated based on the filter. When the report is run, it displays the list of records for that report. I want some of the field values in the report to be a hyperlink.i.e., want that to be navigated to the record detail page if i click a particular field value. Please let me know what are the options available. Here is the screenshot attached for reference.
Mostly name fields in salesforce will have hyperlink by default. For other fields if we want to have we need to have custom formula field for the object. I created a custom formula field with the HYPERLINK function.
Here is the formula
HYPERLINK(
IF(
CONTAINS($Api.Partner_Server_URL_260, 'visual'),
'https://'+
MID($Api.Partner_Server_URL_260, FIND( 'visual', $Api.Partner_Server_URL_260)-4,4)
+'salesforce.com/',
LEFT($Api.Partner_Server_URL_260, FIND( '/pagename', $Api.Partner_Server_URL_260))
) + Id ,
custom field name/ or any string
)

Multiple field groups with empty fields

I'm trying to make this working
[Title Field] [Link Field]
[Add More values] // Will add a [Title Field] [Link Field]
But for example the first [Title Field] is having the value: Foo. With a link to http://foogle.fo
Then I click on [Add More values], and a new row of a group field is showing. In this row I only write in the [Link Field].
When I save this, it will also save the right connection between Title and Link field. But how could I possibly print this in a loop, like this print_r($node->field_titel); this will only return one field (that one with a value), I also want the empty one so I could fetch the links connected to each title.
See image for clearer information about the field groups.
So if there would be a third row, the second row would not fetch the second Beskrivning value, it will fetch the third Beskrivning. Because the object $node->field_beskrivning Will not return any empty results.
So, what I want is a $node->field_beskrivning with the empty rows in right order or any other examples of solutions.
You can try Field Collection module
The Field Collection module is the successor to the CCK3 Multigroup.
It allows a set of fields to be combined together and treated as a
single field. For example, a field collection named Playlist can be
created consisting of the text fields Song and Artist. When a Playlist
entry is created the Song and Artist fields are presented together as
elements of the Playlist field.

Resources