Form Assembly :: Concatenate fields in a Repeatable section - forms

I have a Type and Phone number field in FormAssembly which is repeatable. When users add 2 entries like the one below,
User Entries:
Type: "Mobile" Number:6787867890
Type: "Landline" Number:7898878987
I need to concatenate the above entries to a single field like the one below using Calculation Fields
Expected Result:
Mobile:6787867890|Landline:7898878987
Any idea on how this can be achieved using Calculation fields in FormAssembly?

Just got this working by using 2 Calculation Fields. In the Repeatable section, I added a Calculation field(vEntries) which is hidden. vEntries will concatenate Type: "Mobile" Number:6787867890 to "Mobile:6787867890".
I declare another Calculation field(vFinalEntry) outside the repeatable section, this field is responsible for concatenating all the vEntries.
So when the user enters the second entry Type: "Landline" Number:7898878987, the vFinalEntry variable will have the value "Mobile:6787867890|Landline:7898878987".

Related

PowerShell script to update SharePoint Online list items does not save all column values

I'm processing a CSV file to create SharePoint Online list items and save metadata as fields in its custom content type. At first, I thought it would be an issue related to column type, but I'm failing to save some simple text field values. What's puzzling is that I am able to save some but not other fields - even though I'm using the same means to do this - somehow the list item is not preserving all the values I send in for the list item update.
I create a new item with the following code:
$newFile = $targetfolderObj.Files.Add($FileCreationInfo)
$targetContext.Load($newFile)
$spContext.ExecuteQuery()
Then I get the list item and start setting the field values
$newFileListItem = $newFile.ListItemAllFields
$newFileListItem.Properties["ColumnNameA"] = $_.CustomValue1 # saves
$newFileListItem.Properties["ColumnNameB"] = $_.CustomValue2 # not saving !!!
$newFileListItem.Properties["ColumnNameC"] = $_.CustomValue3 # saves
After setting up the properties with values I call the update and execute functions.
$newFileListItem.Update()
$spContext.ExecuteQuery()
$.CustomValue1 $.CustomValue2 and $_.CustomValue3 when printed all read as "Hello" for example, there are no special characters or symbols here - even hardcoding the field values to simple strings will fail to update field 2 but works on 1 and 3.
I am giving this example with my code to show it's not sequential - for example field 2 data is NOT saved but field 1 and 3 data is saved.
It always fails on the same columns, I verified the columns exist, I'm using the internal field names, string length is well within range, and there is no other validation applied on these columns. What could I possibly do to troubleshoot this?
After a lot of debugging, I'm seeing SharePoint funnery at play...
while the content type is there, and the content type internal field name is "ColumnNameA" something must have gone sideways in the library instance, causing the column name to now be "ColumnNameA0" yes, a zero added at the end of the column name. Every column that was not updating had somehow now a "zero" at the end of the internal column name.
Solution 1: add the zero
Solution 2: recreate the library and re-associate it with the site conten type
I went with Solution 1 to test that my updates worked, then rebuilt the library.

How to select columns using a wildcard search on column names in SPSS Modeler

I am doing time series analyis predicting sales for a large amount of products. After executing the time series node, I get a table containing the original sales data and predicted values with a suffix "$TS-" before the product name. Now I would like to select / filter only those columns containing a "$TS-" in the column name.
There is no easy or straightforward way to do something like this. The simplest way, in my opinion, would be to
Add a 'Filter' node after the time series model nugget
Use the funnel button to "Remove all Fields"
Select to include each of the individual fields that you would like to keep
Make sure that the node is set to Include fields by default
If fields are added to your original data sources or if new fields are derived in the stream, you'll have to go back to this node and remove them, so it's not ideal.
The alternative is to use a stream script to change the inclusion and removal of the fields within a "Filter" node. The script below will search for a "Filter" node with the name given by the variable filterNodeName and search for fields with the prefix given by the variable fieldNamePrefix and keep only the fields that match the designated prefix.
filterNodeName = "TS Fields Only"
fieldNamePrefix = "$TS-"
diagram = modeler.script.diagram()
# Find the 'Filter' node
renameFieldsNode = diagram.findByType('filternode', filterNodeName)
# Get the input data model - the fields that go into the 'Filter' node
fields = renameFieldsNode.getInputDataModel()
# Loop through all of the fields
for field in fields:
fieldName = field.getColumnName()
if fieldName.startswith(fieldNamePrefix):
# If the field name starts with the designated prefix then include the field
renameFieldsNode.setKeyedPropertyValue('include', fieldName, True)
else:
# Otherwise do not include the field
renameFieldsNode.setKeyedPropertyValue('include', fieldName, False)

SSRS Multiple Dataset Errors

I have a simple SSRS report that displays data from one table. What I want to do is have a distinct list from that table displayed in a drop down list for the user to select. If I only use one dataset I can get it to display, but it displays values from the column multiple times.
Example
Bob
Bob
Bob
Cathy
Cathy
If I create a second dataset that will list distinct values I get the following error message:
An Error occurred during local report processing. The definition of the report is invalid. The Variable expression for the report 'body' refers directly to the field without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope.
I"m trying to follow the example I found here:
http://msdn.microsoft.com/en-us/library/aa337400.aspx
The second dataset is only for the parameter list. I don't understand why it's causing problems with the actual report.
It's impossible to tell exactly where without the report definition, but there is an item on the report that is referencing a field or Dataset, and was implicitly using the only Dataset present in the report, but now doesn't know which Dataset to use once more than one is added to the report.
For example, when you create a table you can set a Dataset associated with it. If this is not set and there is only one Dataset, it doesn't matter as it will take the only one available. Once you add a new Dataset, the table doesn't know which one to use and you'll get the error you're seeing.
Another way to get the error is specifying a field in an expression, e.g. in a TextBox in the report somewhere without specifying the scope; just set the scope to a particular Dataset e.g. if you have:
=Count(Fields!name.Value)
change this to:
=Count(Fields!name.Value, "DatasetToUse")
If you've only got one Dataset the first expression will run fine by using the only one available, but once you add another it won't know which to use and it will error.
in the query (SQL) you should add DISTINCT clause at the beginning, that way, you will get only one record per value. Check out http://www.w3schools.com/sql/sql_distinct.asp
Double click the Dataset which contains that field.
Go to fields on the left and delete that field.
Add new field by clicking Add -> Query Field.
Just type in the name of the new field under field name and field source.
It happens when you have added a field by selecting "Calculated Field" instead of "Query Field" from Dataset Fields list tab.
Cheers,
Ahmed Latif

Reporting Services and Dynamic Fields

I'm new to reporting services so this question might be insane. I am looking for a way to create an empty 'template' report (that is basically a form letter) rather than having to create one for every client in our system. Part of this form letter is a section that has any number of 25 specific fields. The section is arranged as such:
Name: Jesse James
Date of Birth: 1/1/1800
Address: 123 Blah Blah Street
Anywhere, USA 12345
Another Field: Data
Another Field2: More Data
Those (and any of the other fields the client specifies) could be arranged in any order and the label on the left could be whatever the client decides (example: 'DOB' instead of 'Date of Birth'). IDEALLY, I'd like to be able to have a web interface where you can click on the fields you want, specify the order in which they'll appear, and specify what the custom label is. I figured out a way to specify the labels and order them (and load them 'dynamically' in the report) but I wanted to take it one step further if I could and allow dynamic field (right side) selection and ordering. The catch is, I want to do this without using dynamic SQL. I went down the path of having a configuration table that contained an ordinal, custom label text, and the actual column name and attempting to join that table with the table that actually contains the data via information_schema.columns. Maybe querying ALL of the potential fields and having an INNER JOIN do my filtering (if there's a match from the 'configuration' table, etc). That doesn't work like I thought it would :) I guess I was thinking I could simulate the functionality of a dataset (it having the value and field name baked in to the object). I realize that this isn't the optimal tool to be attempting such a feat, it's just what I'm forced to work with.
The configuration table would hold the configuration for many customers/reports and I would be filtering by a customer ID. The config table would look somthing like this:
CustID LabelText ColumnName Ordinal
1 First Name FName 1
1 Last Name LName 2
1 Date of Birth DOBirth 3
2 Client ID ClientID 1
2 Last Name LName 2
2 Address 1 Address1 3
2 Address 2 Address2 4
All that to say:
Is there a way to pull off the above mentioned query?
Am I being too picky about not using dynamic SQL as the section in question will only be pulling back one row? However, there are hundreds of clients running this report (letter) two or three times a day.
Also, keep in mind I am not trying to dynamically create text boxes on the report. I will either just concatenate the fields into a single string and dump that into a text box or I'll have multiple reports each with a set number of text boxes expecting a generic field name ("field1",etc). The more I type, the crazier this sounds...
If there isn't a way to do this I'll likely finagle something in custom code; but my OCD side wants to believe there is SQL beyond my current powers that can do this in a slicker way.
Not sure why you need this all returned in one row: it seems like SSRS would want this normalized further: return a row for every row in the configuration table for the current report. If you really need to concatenate then do that in Embedded code in the report, or consider just putting a table in the form letter. The query below makes some assumptions about your configuration table. Does it only hold the cofiguration for the current report, or does it hold the config for many customers/reports at once? Also you didn't give much info about how you'll filter to the appropriate record, so I just used a customer ID.
SELECT
config.ordinal,
config.LabelText,
CASE config.ColumnName
WHEN 'FName' THEN DataRecord.FirstName
WHEN 'LName' THEN DataRecord.LastName
WHEN 'ClientID' THEN DataRecord.ClientID
WHEN 'DOBirth' THEN DataRecord.DOB
WHEN 'Address' THEN DataRecord.Address
WHEN 'Field' THEN DataRecord.Field
WHEN 'Field2' THEN DataRecord.Field2
ELSE
NULL
END AS response
FROM
ConfigurationTable AS config
LEFT OUTER JOIN
DataTable AS DataRecord
ON config.CustID = DataRecord.CustomerID
WHERE DataRecord.CustomerID = #CustID
ORDER BY
config.Ordinal
There are other ways to do this, in SSRS or in SQL, depends on more details of your requirements.

Create a new FileMaker layout showing unique records based on one field and a count for each

I have a table like this:
Application,Program,UsedObject
It can have data like this:
A,P1,ZZ
A,P1,BB
A,P2,CC
B,F1,KK
I'd like to create a layout to show:
Application,# of Programs
A,2
B,1
The point is to count the distinct programs.
For the life of me I can't make this work in FileMaker. I've created a summary field to count programs resetting after each group, but because it doesn't eliminate the duplicate programs I get:
A,3
B,1
Any help much appreciated.
Create a a summary field as:
cntApplicaiton = Count of Application
Do this by going into define fields, create a field called cntApplication, type summary. In the options dialogue make the summary field a count on application
Now create a new layout with a subsummary part and nobody. The subsummary should be sorted on Application. Put the Application and cntApplication fields in subsummary. If you enter browse mode and sort by Application you ought to get the data you want.
You can also create a calc field with the formula
GetSummary(cntApplication; Application)
This will allow you to use the total number of Applications with in a record
Since I also generate the data in this form, the solution I've adopted is to fill two tables in FileMaker. One provides the summary view, the other the detailed view.
I think that your problem is down to dupliate records and an inadequate key.
Create a text field called "App_Prog". In the options box set it to an auto-enter calc, unchecking the 'Do not replace...' option, and use the following calc:
Application & "_" & Program
Now create a self join to the table using App_Prog as the field on both sides, and call this 'MatchingApps'.
Now, create (if you don't alread have one) a unique serial number field, 'Counter' say, and make sure that you enter a value in each record. (Find all, click in the field, and use serial number option in'Replace Field Contents...')
Now add a new calc field - Is_Duplicate with the following calc...
If (Counter = MatchingApps::Counter; "Master Record" ; "Duplicate")
Finally, find all, click in the 'Application field, and use 'Replace Field Contents...' with a calculation to force the auto-enter calc for 'App_Prog' to come up with a value.
Where does this get you? You should now have a set of records that are marker either "Master Record" or "Duplicate". Do a find on "Master Record", and then you can perform your summary (by Application) to do a count of distinct application-program pairs.
If you have access to custom functions (you need FileMaker Pro Advanced), I'd do it like this:
Add the RemoveDuplicates function as found here (this is a recursive function that takes a list of strings and returns a list of unique values).
In the relationships graph, add another occurrence of your table and add an Application = Application relationship.
Create a calculated field in the table with the calculation looking something like this:
ValueCount(RemoveDuplicates(List(TABLE2::Program)))
You'll find that each record will contain the number of distinct programs for the given application. Showing a summary for each application should be relatively trivial from here.
I think the best way to do this is to create a separate applications table. So as you've given the data, it would have two records, one for A and one for B.
So, with the addition of an Applications table and your existing table, which I'll call Objects, create a relationship from Applications to Objects (with a table occurrence called ObjectsParent) based on the ApplicationName as the match field. Create a self join relationship between Objects and itself with both Application and Program as the match fields. I'll call one of the "table occurrences" ObjectsParent and the other ObjectsChildren. Make sure that there's a primary key field in Objects that is set to auto-enter a serial number or some other method to ensure uniqueness. I'll call this ID.
So your relationship graph has three table occurrences:
Applications::Applicaiton = ObjectsParent::Application
ObjectsParent::Application = ObjectsChildren::Application, ObjectsParent::Program = ObjectsChildren::Program
Now create a calculation field in Objects, and calculating from the context of ObjectsParent, give it the following formula:
AppCount = Count( ObjectsChildren::ID )
Create a calculation field in Applications and calculating from the context of the table occurrence you used to relate it to ObjectsParent with the following formula:
AppCount = ObjectsParent::AppCount
The count field in Objects will have the same value for every object with the same application, so it doesn't matter which one you get this data from.
If you now view the data in Applications in list view, you can place the Applications::Application and Applications::AppCount fields on the layout and you should get what you've requested.