There are three tables:
Services:materialName::ServiceTransactionsLineItems:Material_FK and Services:MaterialYear::ServiceTransactionLineitems:TransactionLineItemYear
(Services may change from year to year, and within one transaction you might line items for both current and future years.)
:Services:MaterialBudgetAllocation is a user entered number.
What I am hoping to do is: Get the yearly total amounts of each material (Material_FK) and subtract that from Services:MaterialBudgetAllocation to get a remaining amount.
How do I split the contents of a text field into multiple chunks using the last ". " as end of text?By Quito
Charles Ross (Chuck) posted the following script in 2010 to split the contents of a text field into text chunks, using the last period (within a period count) as text chunk separator:
MaxString = Left( String; 100 );
// Get the first 100 characters of the original string.
PeriodCount = PatternCount( MaxString; "." );
// Find out how many periods are in the substring.
PeriodPos = Position( PeriodCount; "."; 1; PeriodCount );
// Get the position of the last period.
Substring = Left( MaxString; PeriodPos )
I've only been able to get the first line to work with a given number of characters:
Left ( String ; 1880 )
When I add the rest of the script there is no error message, yet nothing is recovered from the String.
The second problem I have is: As the remaining text will not necessarily start at 1880, how do I calculate the recovery of the remaining text after the first text chunk is collected?
Thanks very much beforehand,
I am having a tough time getting the set field by name script step to work and hoping someone can help me with this.
I have a file of sales transactions over many years. I have a related file for customers. The customer file has counters for how many times a customer visits each year, how many suits, sportcoats, etc. they buy each year ( visits_2017, visits_2016, visits_2015, suit_count_2017, suit_count_2016, suit_count_2015 and so forth). I would like my script to evaluate the year of the transaction in sales and update the appropriate counter in customers.
I have been unsuccessful in defining a variable and set field by name combination to accomplish this task. Any recommendations?
I'm reframing a question that I posted in a confusing way. Using variables seems so simple to me, but I know I'm missing something. I'll just post exactly what I'm trying to do so you guys can tell me why it isn't working.
The project is a db that will handle shift schedules for employees. In the one-day view I'm looking at, the essential live field is a global date field called gDate_of_work. A portal is looking through to related records and returning a list of employees (from a table called staff_schedule_match), identified here by unique serials, who are scheduled to work that day. There is a second portal, located on the same layout, that is (correctly) showing a separate related list, of employees who are available to work on the day of the week.
I, of course, want to be able to click on the name of an available employee and pass her serial number, along with the date in the global date field, to a new record in staff_schedule_match. In the distant past, I've sometimes solved this by opening layouts in offscreen windows and having extra fields dedicated to this data transaction, sometimes even by using the computer's clipboard (i.e. copy/paste).
The script I'm trying to execute here goes:
Set variable ($shift_add_nuid; employee's serial number from related record two) Set variable ($work_date; date displayed in this global date field) Freeze window Go to layout staff_schedule_match New Record Set Field (staff_schedule_match:nUID; $shift_add_nuid) Set Field (staff_schedule_match:StartDate; $work_date) Set Field (staff_schedule_match:EndDate; $work_date) Commit Record Go to layout (original) Refresh window Stepping through the script watching Data Viewer, I can see that the correct data is getting loaded into the variable values, but I can also see that the destination fields show up with an Unrelated table error. I don't understand why - I expected the behavior to be destination-agnostic, like my computer's clipboard, where if I copy some text in an email, I can paste it into a word processor or a browser or whatever.
My goal here is to write a database with tidier relationships than I've used in the past, so I'm intending to use discrete table occurrences of the same data. Here's the roadblock:
In layout 2_week_schedule, I have 14 portals that display a staff schedule (two weeks' worth) and can't be edited. My goal is that a logged-in administrator can click on the date field of any one of those fourteen days and go to a layout 1_day_schedule that is displaying the same information, though with more details and one day at a time.
The underlying table of each layout is the same, though the layouts are based on different TOs.
I wrote this with a script trigger in the date field in 2_week that fires a script to copy its value as date to variable $date, switch to the 1 day layout, and set the pertinent date field there to variable $date (and then commit).I don't know if it's my error, but I think of variables as being like my computer's clipboard - any value can be copied & pasted to/from. But the script fails with the message The operation could not be completed because the target is not part of a related table.
I did try a simple redundant relationship (connecting the two pertinent fields), but that was a hail Mary, and didn't do the trick anyway. Is there a better way to accomplish what I want? In short, I want administrator who's scrolling through the existing schedules to be able to look at any date where she wants to make a change, click on it, grab its contents, and be brought to a more flexible interface where its contents get inserted into a portal that will then show her the results.
This file is web-accessible, so I can post its address if it helps to see what I'm talking about.