Initializing Additional Fields On Import
Initializing Additional Fields On Import
I'm importing a flat file to an external (SQL Server) table. I want to initialize several additional fields in each record that don't exist in the import file (LIRU.ID and LIRU.LoginName). I've been trying to do this using "when object is created or modified" rules. I get no errors, and the import runs fine, but the additional fields remain null. Is this because it's an external table? What's the best way to do this? I essentially want to store the ID/Name of the user who loaded the data in each record. Thank you.
Re: Initializing Additional Fields On Import
I tried this using a local table rather than SQL Server and it's behaving the same. No initialization of the additional fields. I'm simply doing "BO.UserID = LoggedInRegularUser.ID" and "BO.Username = LoggedInRegularUser.LoginName" in "when object is created or modified" rules of the BO. Any idea what I'm doing wrong, and is there a better way to do this? Thanks.
Re: Initializing Additional Fields On Import
I've added "BO IS NEW" conditions to all the "when object is created or modified" rules. Still no change. It's as if the rules aren't firing when the records are imported.
Re: Initializing Additional Fields On Import
EXACTLY how are you doing this?Stetson wrote:I'm importing a flat file to an Aware Table
pics?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Initializing Additional Fields On Import
Hi, Jaymer. I'm using an import template. I was just about to check if I have validation on.
Re: Initializing Additional Fields On Import
Screenshot of import template being used. (When I select validation, which I believe is needed to fire the rules, import never finishes. File is micro. Just 3 record of 2 fields. So not sure what's up with using validation.)
- Attachments
-
- Loading to both external and internal tables, import just sits if Validation on. Have been trying since yesterday. Only 3 records of 2 fields each. ???
- Import.png (27.03 KiB) Viewed 12887 times
Re: Initializing Additional Fields On Import
Here are my "when object is created or modified" BO rules for the table I'm importing to.
- Attachments
-
- Import.png (11.57 KiB) Viewed 12887 times
Re: Initializing Additional Fields On Import
Simple table. Only 4 fields. Importing Invoice and Amount. Want to auto-initialize UserID and Username (to LIRU.ID and LIRU.LoginName) on or immediately after import. When validation not selected, Invoice and Amount import fine (but UserID and Username remain null). When validation selected, import hangs with no error message. So 2 issues really: the null UserID and Username, and the import not working when validation selected.
- Attachments
-
- Import.png (11.68 KiB) Viewed 12885 times
Re: Initializing Additional Fields On Import
Are Username and UserID, required attributes?
You mentioned being Ok about them being initialized immediately after import. Have you tried importing without validation, then running a process to UPDATE all instances of that BO?
You mentioned being Ok about them being initialized immediately after import. Have you tried importing without validation, then running a process to UPDATE all instances of that BO?
Tom - V8.8 build 3137 - MySql / PostGres
Re: Initializing Additional Fields On Import
Username and UserID are not required attributes (because I figured the import would fail if they were). I thought about initializing the fields after import with a process. The only issue would be that if 2 users are importing at the same time, I need to be sure not to mix their records. So if I could be sure that a post-import process would ONLY act on the records imported by a specific user, I would try something like that. Would this work if, for example, I ran such a process immediately after import? Or would I still risk hitting other user records that may have subsequently been imported? Actually, all of this is why I thought "when object is created/IS NEW" would have been the perfect solution. Still not understanding why those don't fire. Unless they need validation to be on, in which case I guess my core problem now is that my import hangs when I select validation. I've been testing this over and over. The import completes fine without validation, but hangs and doesn't complete when I select validation.
Re: Initializing Additional Fields On Import
If you remove IS NEW and run and UPDATE after the IMPORT, do the proper values get populated?
Tom - V8.8 build 3137 - MySql / PostGres
Re: Initializing Additional Fields On Import
Right! It seems like the IS NEW is ignored during imports, so just have a rule that looks like:
BO.attr = someValue......
Bruce
BO.attr = someValue......
Bruce
Re: Initializing Additional Fields On Import
Stetson,
I have tried to duplicate your issue, but it works for me.
What version of Aware are you using?
Have you looked at the logs for any indication of the issue?
Maybe post screen shots of your template.
I have tried to duplicate your issue, but it works for me.
What version of Aware are you using?
Have you looked at the logs for any indication of the issue?
Maybe post screen shots of your template.
Bob
Re: Initializing Additional Fields On Import
Thanks. 8.4
Will try suggested ideas.
Will try suggested ideas.
Re: Initializing Additional Fields On Import
Here's my import template.
So far, no luck with UPDATE. I will need to check the logs (need to switch from service to control panel). I'm wondering if SQL Server is the problem once again.
Statement@@@@@Imports a vendor statement@@@@@Statement@@@@@Import@@@@@0,String,Invoice@1,Double,Amount,#0.00@@@@@Statement.Invoice={Invoice}^Statement.Amount={Amount}@@@@@-1@@@@@null@@@@@Invoice@Amount@@@@@,
So far, no luck with UPDATE. I will need to check the logs (need to switch from service to control panel). I'm wondering if SQL Server is the problem once again.
Statement@@@@@Imports a vendor statement@@@@@Statement@@@@@Import@@@@@0,String,Invoice@1,Double,Amount,#0.00@@@@@Statement.Invoice={Invoice}^Statement.Amount={Amount}@@@@@-1@@@@@null@@@@@Invoice@Amount@@@@@,