Hello Filemaker developers, I’m writing an application to support some contactmanagement, invoices, sales orders, inventory, …
The application will be used by different people on different locations, on different devices.
A (in the meanwhile) good friend of mine offers his help developing my application. He is not familiar with Filemaker but he is an authority in data modelling, requirements analysis, business integration, modular design, …
He is the Jedi, I’m the padawan.
On his advice I’m refactoring/optimising (pieces of) the application for several reasons. One of them is to avoid unnecessary data access as much as possible. (reduce to the minimum). Too bad I’m not a Filemaker guru who can implement his wise words in a breeze.
At this point we are looking for a solution to refactor a small piece of logic for a simple frontend concern. We are wondering if it is possible to implement this functionality without even accessing the database.
In this case we need to manage the correct state of a sales order.
Different people will do a follow up of the sales order so it is very important to always have the correct state of the order.
Some states must be set automatically, others must be set manually.
We need to avoid errors in the manual manipulations of the states.
Only valid states must be available depending on the current state of the order.
Take a look at the attachment : order state diagram
I want to change my current code (magic valueslist/conditional valuelist – linked to a table) into a piece of logic, whereby the set of valid states the user can choose from, is calculated without accessing my database.
This is the logic I’m trying to implement on my order screen :
- 1. display order information
- 2. calculate the valid new order states based on the current state value
- 3. fill a listbox with the calculated order states
- 4. select a new value from order states
- 5. save the order/update new state
I’m want to implement step 2 and 3 without accessing my database.
Hereby the logic of my state calculation:
Case order_state = code_Init
Set StateList (1)= (code_Ordered, ‘Ordered’)
Set StateList (2)= (code_Refused, ‘Refused’)
Case order_state = code_Ordered
Set StateList (0)= (code_Ordered, ‘Ordered’)
Set StateList (1)= (code_Delivered, ‘Delivered’)
Case order_state = code_Delivered
Set StateList (0)= (code_Delivered, ‘Delivered’)
Set StateList (1)= (code_Checked, ‘Checked’)
Set StateList (2)= (code_Incomplete, ‘Incomplete’)
Set StateList (3)= (code_Damaged, ‘Damaged’)
Case order_state = …
Some notes :
All my state codes (code_Deliverd, code_Checked, …) are stored in a systemcode table.
These codes won’t change very often, so they can be used hard coded.
I’m trying to populate my listbox, using a 2-dimensional array ( statelist[ ][ ] ), rather than accessing the database.
To be clear, I’m aware of workarounds like the magical valuelist trick
but I was hoping for a more elegant (hardcoded) solution for populating and displaying the valid states.
Thanks for taking the time reading this, and thanks for your input ! Mucho appreciated !
State_Order.jpg 37.4 K