Initializing Additional Fields On Import

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Initializing Additional Fields On Import

Post by Stetson »

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.
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

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.
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

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.
Jaymer
Posts: 2457
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Initializing Additional Fields On Import

Post by Jaymer »

Stetson wrote:I'm importing a flat file to an Aware Table
EXACTLY how are you doing this?
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
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

Hi, Jaymer. I'm using an import template. I was just about to check if I have validation on.
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

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. ???
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 12658 times
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

Here are my "when object is created or modified" BO rules for the table I'm importing to.
Attachments
Import.png
Import.png (11.57 KiB) Viewed 12658 times
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

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
Import.png (11.68 KiB) Viewed 12656 times
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Initializing Additional Fields On Import

Post by tford »

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?
Tom - V8.8 build 3137 - MySql / PostGres
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

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.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Initializing Additional Fields On Import

Post by tford »

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
BLOMASKY
Posts: 1473
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Initializing Additional Fields On Import

Post by BLOMASKY »

Right! It seems like the IS NEW is ignored during imports, so just have a rule that looks like:

BO.attr = someValue......

Bruce
BobK
Posts: 545
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Initializing Additional Fields On Import

Post by BobK »

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.
Bob
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

Thanks. 8.4
Will try suggested ideas.
Stetson
Posts: 54
Joined: Tue Dec 04, 2018 11:00 pm

Re: Initializing Additional Fields On Import

Post by Stetson »

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@@@@@,
Post Reply