Duplicate ALL Filemaker Portal Rows only if valid - filemaker

I would like to create a script that copies only valid Portal Rows from a Record.
ie. Sample Request is the main record
Sample colours are the relationship (SampleNumberID)
ie. Colour 1, Colour 2, Colour 3, Colour 4
I can get this for work if it has all 4 rows entered, however if there is ok 2 colour entries It will copy it twice to fill up 4 portals every time.
Any help would be great, Thanks.
Image of Current Script working for 4 colour ways however if only 1 colour is entered it will copy the same colour 4 times.
http://www.coquet.com.au/wp-content/Script.png

Here is how I would do it, I would go to the related records, using the portal row relationship. Go to the first record, loop through them all and duplicate each one and then return to the parent record. So it would look something like this:
Go to Related Record [Show only related records; From table: "Sample Request"]
Go to Record/Request/Page [First]
Loop
Duplicate Record/Request []
Set Field [ByCoulor::StyleNumberID; GetNextSerialValue(Get(FileName); "Sample Request")]
Go to Record/Request/Page [Next; Exit after last]
End Loop
Go to Layout [original layout]
As a side note, it looks like you might to set the field StyleNumberID as an Auto-Enter serial number, so you don't have to manually set it.

Related

Create multiple records in a table using 1 form in MS Access 2013

I know this has been asked before, but I couldn't figure it out in my case.
I have a table called t_JOB, and one of the columns is "PO #". Each PO # can have multiple PO Line Items. So I created a table called t_PURCHASES_PO_ByLI which has the columns "PO #", "Line #" and "Line Amount". PO # from the t_Job table is a primary key and is a 1 to many relationship with the PO # in the t_PURCHASES_PO_ByLI Line Items table.
I want the user to be able to enter the PO # in the t_JOB table as well as the line # and line amount for as many lines items as they want in 1 form. Now after some research I added a subform and was able to do this BUT, it only worked if I entered 1 line # and line amount. I had the textboxes for more but it wouldn't send the values.
I understand forms are supposed to be for 1 record only, but in this case it would make sense for the user to be able to enter the PO #, and well as all of the line #'s and amounts associated with it all at once. How can I do this or is there a different way to go about solving this?
Edit
Here is what I enter in my form:
Notice how it only stores the value 5 for the Line #'s? The default values for each are 1, 2, 3 respectively. Only when the form first loads and I switch from the Line #1 textbox to the description #1 textbox does it change to 5. If I go and change it back to 1, all the values for line # switch to 1. They don't stay at 1, 2 and 3.
Also, notice how all of the description textboxes are the same? I don't want this to be the case, but whenever I edit one of the description boxes, it edits them all. How can I make them unique?
Here is what gets written to the t_JOB table:
Here is the data stored in the t_PURCHASES_PO_ByLI:
Also, I read up on Multiple-item forms, but I can't figure out how to add one as a sub-form. Any ideas on how to do that?
Your subform Line Items seems to be a "single form", i.e. its DefaultView property is Single Form.
And you have 3 sets of controls, probably each of them with the same control source, therefore they will always show the same value.
Change the Default view to Continuous Forms, and remove all but one instance of each field (remove the #2 and #3 controls). Then you will be able to enter multiple records in the Line table.

How do alternate row colors in an SSRS 2008 report?

I'm trying to alternate row colors in one of my reports. So following some advice from the web, I've tried putting something like this for the background color of the rows in question:
=IIF(RowNumber('manager') Mod 2, "LightBlue","White")
Where manager is the name of my row group.
But what this does is make the color alternate every time a value is present. And some of the rows that aren't even supposed to be colored get colored. I really don't get it, but perhaps the fact that there's a column group is messing things up somehow?
I've also tried numbering each row in my query and going off that but I still get the same weirdness.
And I even tried returning the color in my query and it gets even stranger because then every single row is colored Light blue, and again even the ones that aren't supposed to get colored. Just Visual Studio being buggy as always I suppose?
RowNumber('manager') resets to 1 when you get a break in the manager group. So rows under that manager may toggle.
=IIF(RowNumber(Nothing) Mod 2=0, "LightBlue","White") seems to work OK with Nothing in the group.
As you said, you can also number each row in the result set (identity column?). Then you want to check the value of your numbered column rather than use the RowNumber function.
=IIF(Fields!id.Value Mod 2 = 0, "LightBlue","White")

How to color code cells of a column based on the text value in Tableau

I'm a new tableau developer trying to develop a table based tableau report. I have a column in the table called "Status" which essentially contains 3 values "In progress" , "Blocked" and "Completed". I want to color code the cells of this column based on these text values. I was unable to get this from the tableau community and hence posting it here. Anyone faced this problem? Kindly let me know how you solved it.
Raghu
First thing, Tableau is not excel. Stop trying to make Tableau work like excel, you'll miss most of the power Tableau brings, and make it inefficiently operate like Excel.
That being said, let me give you an alternative. Instead of text chart (which is what you're using to get a table), select Shape chart. This will add balls in the last column (but you can choose what shape you want)
Now drag the Status to color, and voilĂ , the balls are painted accordingly to Status. You can customize the shapes too (just drag some field to Shape), and selected what shape and color you want to each value.
This will look more like a "control panel", with the color of the balls something like a traffic light. You can even import some pictures of traffic lights and use them as shapes, that could be cool (if properly used)
I know this post is a couple years old, but there is a way to do this. In a new tableau workbook, import the data from Excel (just one column with the status values). Rename the table to "Status Colors" with a dimension field called "Status". Click the dimension field "Status" and select Default Properties > Colors. Assign the colors to each data item (value). For custom colors (RGB, HTML, etc.) double-click the color next to the value and assign the desired color. Click OK, then publish the data source to the server with the options checked to "Include external files".
You now have a Tableau data source that can be added as data to any other workbooks that when linked, the [Status Colors].[Status] can be used as the color key for the field on any graphs. The default colors are stored in the data source. If you update the color workbook, then it will update any other workbooks that use this data source.
Since SO community has thrown it in active threads, let me propose an answer. Though, I completely agree that we shouldn't replicate features of excel in Tableau, yet here is one workaround.
I took a dummy data like this
create a calculated field say status cf with the following calculation
CASE [Status]
WHEN 'In Progress' THEN 'Yellow'
WHEN 'Completed' then 'Green'
WHEN 'Blocked' then 'Red'
END
create two more CFs say 1 and 0 with just 1 and 0 in these as calculations.
Drag dummy and status to rows shelf. sum(0) and sum(1) to columns shelf.
Drag status cf to sum(0). Edit sum(0) in marks card with type as shape (square), and increase its size. edit colors as fixed in calculation.
Drag status to label in sum(1) in marks card. change type to text
Convert both measures in columns shelf as dual axis.
After a little formatting, you'll get a text table like this
You may optionally hide, status col in rows shelf

Microsoft Access - I want my mainform to create X records in subform base on fields automatically

I been putting a lot of thought into the logic behind this, and I can't seem to figure out the best way to handle this problem.
1 - Afterinsert
2 - unbound fields + button to insert X times
3 - I am open for suggestions
The form
The relationship
I was debating on using AfterInsert to handle everything. Since NoOfBoxes will decide the amount of records and I would only need to duplicate the value of MergeNo and isCommission to the subform. But the problem is, I need to also auto fill the item, which made me think of solutions number 2.
The reasoning behind going with number 2 is; my receive report header doesn't contains the item information and since a subform can only have 1 type of item but multiple of them. I was hitting toward number 2.
Solution number 2 would be multiple unbound fields which pulled the information into a combo box, or enter the information needed and hit a button which will then transfer all that data to the subform and create the correct amount of records.
unbound fields = itemcode, mergeNo, isCommission, and NoOfBoxes.
I think you need a Numbers table with integers from 1 or 0 to an appropriate number, you can then say something like:
INSERT INTO ATable ( MergeNo, IsCommission )
SELECT [Forms]![aForm]![MergeNo] AS MergeNo,
[Forms]![aForm]![IsCommission ] AS IsCommission
FROM Numbers
WHERE Numbers.Number<=[Forms]![aForm]![NoOfBoxes]
Do not forget that if the numbers table starts from 0, it is less than, not less than or equal to.

Erroneous duplicate rows in BIRT report

I have a problem with a BIRT report I'm working on where I have a nested table in the report. The outer table contains data to do with an item on an invoice, while the inner table contains stuff to do with price banding for labor charges. I've written a separate DataSet which gets the inner data, bound by parameters to data in the outer table. Now, when I preview the inner DataSet in BIRT using the defaults I've given it, it returns two rows of data for that bill number & item number - a normal rate & an overtime rate if you like. When I run the report in full over the same data, the outer table stuff is fine, but the inner table just repeats the same row over twice - it's just the first row repeating.
This is sorta what the table looks like in layout view:
Item Description Rate Quantity Item total
[item] [desc] [rate] [quantity] [total]
...where the price & quantity are in the inner table.
I'd have expected to see something like:
Item Description Rate Quantity Item Total
1 Callout $40 1 $40
2 Labor $30 4.5 $185
$50 1
but instead I get more like:
Item Description Rate Quantity Item Total
1 Callout $40 1 $40
2 Labor $30 4.5 $185
$30 4.5
...even though querying the database & previewing the inner data set based on the same input criteria show the expected result.
Has anyone else had experience like this? I have a hunch it's to do with bindings, but not sure what.
One way to get this behavior is by accidentally replacing a table-level binding with a column-level binding.
For example, define a table by dragging a data set into the report. Select the entire table (use the outline view, or select something in the table and then click on the "Table" button that pops up just below the grid.) Then go to the Binding tab. Note that the data set and column bindings are all filled in.
Now select just one field in the Detail row. On the Binding tab, note that the Data Set is blank, and no column binding is shown. Someone who is confused by this (as I was) might then edit the column's binding and specify the same Data Set that was used to create the table. If you do this you will only see a single value repeated in that column when you run the report. (I believe the overridden column is binding to a second instance of the data set, not the one the table is iterating over.)
Not sure your question can be answered withou looking at the data and the design. But it is important to note that the results you see in the dataset preview, and not neccisarly what you would see if the query was run fully. I have seen difference with 7 records returned. I thought as it was only 7 it would be the same on full run, but it's not. The preview is not just a top 500 query, it has some other (not sure what) filters also.
To problem solve if it is your query or your binding.
If you are using a SQL database. Run the SQL in a SSMS query and see if you get the same results you do when run in the innner table.
Altentively, create a new test report, copy over your dataset and use with a stand alone table.
I think I sorted it, & this is the most bizarre thing: On the child table I'd been deleting the header & footer row & just leaving the detail row in, in the layout view. Last thing today, just before I was going to go home, I tried again - deleted the table for about the 70th time that day, replaced it, re-did the parameter bindings all exactly as before, but this time I left the header row & footer intact. Clicked the preview tab, voila, all shows up correctly. So, since I didn't need the header or footer on the child table, I went into properties, clicked Hide this element, preview again - all good. No difference to the data bindings, no difference to mappings or anything else, no change to the data sets - the only difference was leaving the header & footer in place but hidden.
Contemplating making a bug report, tbh.