Ant Design: How to transform field value? - antd

I noticed that in Ant Design Form, it's possible to set 'transform' for a specific validation rule, which will transform field value before the validation. But I'm wondering whether there's a way to apply a transform to field value when getting a response from getFieldValue or validateFields.
Here is an actual user case. I have a field that accepts multiple email addresses separated by comma, e.g, "foo#example.com, bar#example.com". I've written a transform function which will transform string value of the field to ["foo#example.com", "bar#example.com"]. I'd like to the field value to be the transformed email array instead of raw string when calling getFieldValue. And in values for validateFields callback, I'd like the field value to the transformed array as well.
Is there an easy way to do that?

Related

RDLC Reports: how to hide text, depending on whether all fields in dataset value are NULL?

I am creating RDLC Reports (this one is a subreport actually), that hides a specific Text-Box depending on data available/missing.
Specifically, I want to hide a Text Box, using an "Expression", when all values of a specific DataSet are null. Currently I do only check the first value like so:
=(IsNothing(First(Fields!EventDescription.Value, "MyDataSet")))
This works, regarding only the first item in the DataSet, or when it's empty. How can I check for "All". Is there an "All" operator?
I now have
=((Sum(IIF(IsNothing(Fields!EventDescription.Value),0,1), "MyDataSet") ) = 0)
which looks a little complicated, but works. It
checks whether the given Field is NULL
if not so, provides the integer value 1
sums all those values up
hides the text box, when the sum is zero (all fields have been null)
Essentially this converts an aggregate comparison into a sum.

Jira: Custom Field with multiple values and autocomplete

I would like to have a custom field in Jira that allows you to
input multiple values
allows you to enter arbitrary text values
has a predefined list of "good" values which you can use for some kind of autocomplete.
The "components" field comes close to what I want.
https://confluence.atlassian.com/jirakb/how-to-enable-autocomplete-renderer-for-multi-select-custom-field-in-jira-754978239.html is another approach, turning a select field into an autocomplete field

Dataflow GroupByKey transform splits input rows

I run a data flow job to read data from files stored in GCS, each record has an "event type", my goal is to split the data per "event type" and write each output to a bq table, now I'm using a filter to do this, however I'd like to try GroupByKey transform which hopefully can make the process dynamic as new Event Types will flow in over time which can't be predicted at the development time. So now my challenge is, I don't know if its possible to construct a WRITE transform per each KEY(the key from output GroupByKey)? It would be ideal if its doable, or any other ways can achieve this, any advice would be appreciated
You don't need to write a transform for each value of event type; you just need to write a transform that can handle all values for event type.
A GroupByKey will produce a PCollection<KV<EventType, Iterable<ValueType>>. So each record of this PCollection is a key value pair. The key is an EventType and the value is an iterable of values with this key type. You can then apply a transform which converts each of these keys into a TableRow representing the row you want to create in BigQuery. You can do this by defining a:
ParDo<KV<EventType, Iterable<ValueType>>, TableRow>
For example, if your EventType is a string and your ValueType is a string then you might emit a row with two columns for each key value pair. The first column might just be a string corresponding to the EventType and the second column could be a comma separated list of the values.

How to make TProgressColumn work when used with LiveBindings and datasets

My goal is to have a TGrid with several columns, connected to a TClientDataSet via LiveBindings. One of the columns is of type TProgressColumn.
The grid displays the data, but the progress bar column shows nothing (i.e. 0% progress).
The TProgressColumn is connected to a field of type ftInteger. The values in this field are between 0 and 100.
I've tried with ftSingle, but with no luck.
I set the type of the column to be TProgressColumn via ColumnStyle property, available under TLinkGridToDataSourceBindSourceDB/Columns.
The strange thing is that when I use TPrototypeBindSource to generate values - the TProgressColumn works, but only for ftUInteger values. It fails for ftInteger generators.
Here is a little demo (Delphi XE7):
When I put a breakpoint in TProgressCell.DrawCell() and step over the two conditions for Value.IsOrdinal and Value.IsType are skipped and ClampValue receives a value "Min" which is 0.
There seems to be something wrong with the value, passed to the function.
Is there something special when working with TProgressColumn? Do I need to use CustomFormat, CustomParse in TLinkGridToDataSourceColumn?
Is that a bug or I miss something?
UPDATE:
Thanks to "nompa" the mystery was solved!
In fact "asInteger" is the well known property of the TField class i.e.:
someDataSet.fieldByName('myFieldName').asInteger
In CustomFormat property you can get access to many things, including self.asInteger properties.
More information here:
Using Custom Format and Parse Expressions in LiveBindings
Using binding expressions in the CustomFormat property of a TLinkPropertyToField component
Formatting your Fields
How to treat an Integer field as a Boolean?
The value is string by default, not matter is a integer field. In property CustomFormat write AsInteger.
The value will be take as integer and the progress now is visible.

Multiple field values to subreport error

I have a parent report that feeds one of the field values into a subreport. But the problem is that there this field value can include multiple records. For simplicity, assume that this field value is called color, where possible values might be orange, red, and green. I need to pass all of these value to the subreport, not just one. I have tried passing the values this way into the Color parameter of the subreport:
=Fields!Color.Value
But this doesn't work and gives me an error. I have also tried:
=join(Fields!Color.Value,",")
This also gives me an error on the subreport
I have also tried both of the above as an expression in a textbox in the parent report and I get #Error displayed on the parent report. I was able to successfully get just the first value to appear by using a similar expression and the First function. But I am not able to get all of the values to display in this textbox on the parent report? how can I do this or at least pass all of the values to this subreport?
The easy solution is if Color is already a parameter - I would pass this expression in the subreport:
=Parameters!Color.Value
If Color is not a parameter, I would add a column to the driving dataset in the parent report using a SELECT ... FOR XML to concatenate the relevant Color values together. Then you can pass that field to the subreport.

Resources