I am trying to get the result when both "insert" and "unchanged" have values, but if one of them doesn't have a value, it's going to fail. Can anyone please help?
FME tests individual features. When you use AND in the Tester, no features will pass, as an individual feature cannot have the value fme_db_operation = INSERT and fme_db_operation = UNCHANGEDat the same time. When you use OR in the tester, some individual features wil pass because fme_db_operation = INSERT, other individual features will pass because fme_operation = UNCHANGED; features with other values will fail the test.
Can you provide us with some example data of all relevant categories, with a short description of the data that should pass, and the data that should not pass, and why this is the case?
One is Basin (“AL”,”EP”) 2nd Column is Stormnum (“1”,”2”) and time (“2023/07/25 9:00:00z)
Storm num and time change everything when they release the new data
There are two areas and two files.
extracting the data from two files and If they release the data for "AL" at 2:57, my script will insert this (Consider as new). Then, at 3:00, the "EP" release will occur, and my script will run again. It will truncate the "AL" file and insert the new record for "EP".
and we don't need any historical data when new data arrival just truncate the old one and insert the new one
New try. The last one for today, as I am at the end of my working day.
Is this data flow correct?
An AL feature enters. Add it to the database.
An EP feature enters. If it's storm number already exists in the database, update the EP feature in the database that has the same storm number with the data from the new EP feature (don't touch the other features). But if it's storm number does not exist in the database, remove all data, and insert the new EP feature.
If it is not correct, can you describe the different data flows?
An EP/AL feature enters. If its storm number already exists in the database, update the Any basin feature in the database that has the same storm number with the data from the new
but maybe EP has a new record and Al will not so we don't know which basin update first and which one is not.
In the example you give above, you can always truncate the existing data, and then write the features from the Inserted port of the ChangeDetector (with Match Selected Attributes set to BASIN STORMID VALIDTIME).
If I understand correctly, you are writing to Excel, so you can simply write the inserted features, overwriting the existing Excel file.
Sorry, I still don't understand the logic of the different data flows. The information is shattered across too many posts in this topic. Can you please make a summary?
I hope it is as simple as this:
When a feature enters with BASIN = AL, and STORMNUM is already present in the database, do this: ...
When a feature enters with BASIN = EP, and STORMNUM is already present in the database, do this: ...
When a feature enters with BASIN = AL, and STORMNUM is not present in the database, do this: ...
When a feature enters with BASIN = EP, and STORMNUM is not present in the database, do this: ...
But maybe it is more complicated. In your examples 2 AL features and 1 EP feature enter at the same time. So possibly there are dependencies between the features?
When a feature enters with BASIN = AL, and STORMNUM is already present in the database, Do Nothing (Stay unchanged)
When a feature enters with BASIN = EP, and STORMNUM is already present in the database, Do Nothing (Stay unchanged)
When a feature enters with BASIN = AL, and STORMNUM is not present in the database, Insert it as New But truncate the exiting one
When a feature enters with BASIN = EP, and STORMNUM is not in the database, Insert it as New But truncate the existing one
When a feature enters with BASIN = AL or EP and STORMNUM is not in the database, Insert it as New But truncate the existing one but ifEP or AL and STORMNUM are already present in the database Do Nothing (Stay In database)
So If New data arrive in AL or EP insert with unchanged
"For Example at the moment we have this is excel file
Basin StormNumber validTime
AL. 3 2023/07/25 9:00:01z
AL 4 2023/07/25 9:00:00Z
EP. 3 2023/07/25 9:00:01z
NOW NEW data arrive at 25/07/2023 10:00:00z
Basin StormNumber validTime
AL. 3 2023/07/25 10:00:00z
AL 4 2023/07/25 9:00:00Z
EP. 3 2023/07/25 9:00:01z
so my script will work and truncate the all data and insert only this one
AL. 3 2023/07/25 10:00:00z"
I interpreted this as: When a feature enters with BASIN = AL, and STORMNUM is already present in the database, if VALIDTIME is more recent, remove all existing features from the database and insert this feature.
But now you say: "When a feature enters with BASIN = AL, and STORMNUM is already present in the database, Do Nothing (Stay unchanged)", which seems to be inconsistent with what you wrote before?
When a feature enters with BASIN = AL or EP and STORMNUM is not in the database, Insert it as New But truncate the existing one but ifEP or AL and STORMNUM are already present in the database Do Nothing (Stay In database)
At one place you say that the record in the database should be updated when STORMNUM is already in the database, at another place you say to do nothing. It's not possible to do both at the same time.
Truncate is to remove all records from the database table. But it seems that sometimes it is wanted to remove only all records of one basin?
1. When both insert and unchanged values are present.
2. When only insert values are present.
I need the change detector to insert and unchanged values when both are present and when only insert values when there are no unchanged values. Otherwise, it should do nothing.
either remove only the records of one basin or remove all records