Stupid Context issue. How do I fix this?

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Stupid Context issue. How do I fix this?

Post by Jaymer »

Code: Select all

CREATE WebSection WITH WebSection.SecName='General Vehicle Images', WebSection.SecNum=1, WebSection.ob_WebWentry=WebEntry

CREATE WebPics WITH WebPics.PicSection='Front', WebPics.PicSeq=1, WebPics.ob_WebSection=WebSection
IMPORT DOCUMENT ThatWebPics.PicImage FROM 'c:\WebEntry\000\tta1.png'

CREATE WebPics WITH WebPics.PicSection='Rear', WebPics.PicSeq=2, WebPics.ob_WebSection=WebSection
IMPORT DOCUMENT ThatWebPics.PicImage FROM 'c:\WebEntry\000\tta2.png'

CREATE WebPics WITH WebPics.PicSection='Left', WebPics.PicSeq=3, WebPics.ob_WebSection=WebSection
IMPORT DOCUMENT ThatWebPics.PicImage FROM 'c:\WebEntry\000\tta3.png'

CREATE WebPics WITH WebPics.PicSection='Right', WebPics.PicSeq=4, WebPics.ob_WebSection=WebSection
IMPORT DOCUMENT ThatWebPics.PicImage FROM 'c:\WebEntry\000\tta4.png'

CREATE WebPics WITH WebPics.PicSection='Extra1', WebPics.PicSeq=5, WebPics.ob_WebSection=WebSection
IMPORT DOCUMENT ThatWebPics.PicImage FROM 'c:\WebEntry\000\tta5.png'

CREATE WebPics WITH WebPics.PicSection='Extra2', WebPics.PicSeq=6, WebPics.ob_WebSection=WebSection
IMPORT DOCUMENT ThatWebPics.PicImage FROM 'c:\WebEntry\000\tta6.png'

COMMIT TRANSACTION
This is exactly what I didn't want to do.
Have to copy actual images into place for these 6 records... the user is supposed to upload the image.
But I have to assign "something" or it complains. I cannot leave the PATH ATTRIBUTE empty, so it is set in a rule.

PROBLEM IS this data gets created:
Screen Shot 2018-12-05 at 6.54.17 PM.png
Screen Shot 2018-12-05 at 6.54.17 PM.png (70.71 KiB) Viewed 7145 times

By the time I have created 6 records, all 6 are still in CONTEXT.
So when the final IMPORT happens, it imports that image to ALL 6 CONTEXT records.
I know WHY this is happening,
BUT I DONT KNOW how to do it like you would in any OTHER language.

Splitting it into different rules in the same process doesn't help.
DO I REALLY have to have a "master" process, and then 6 separate processes?
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
customaware
Posts: 2392
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Stupid Context issue. How do I fix this?

Post by customaware »

Normally the answer would be yes.... CREATE should generally be in a Sub Process...

However, looking at what you are wanting to do... I would try to have 1 Sub Process that calls an EXEC_STRING.
Not sure if it will work but try this.....


In the Head process.....
6 Rules

Rule 1:
SystemSettings.PicSeq=1
CallSubProcess

Rule 2:
SystemSettings.PicSeq=2
CallSubProcess

etc etc

Sub Process:
EXEC_STRING `CREATE WebPics WITH WebPics.PicSection='Front', WebPics.PicSeq=`+SystemSettings.PicSeq+`, WebPics.ob_WebSection=WebSection
IMPORT DOCUMENT ThatWebPics.PicImage FROM 'c:\WebEntry\000\tta`+ SystemSettings.PicSeq'+`.png'`
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Stupid Context issue. How do I fix this?

Post by Jaymer »

Sure, make it even MORE convoluted than it has to be :)

FROM my exp, an EXEC STRING terminates the rule...
i.e. nothing else executes after it in that rule.

thx for the suggestion
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
customaware
Posts: 2392
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Stupid Context issue. How do I fix this?

Post by customaware »

Works for me.....

Import BSV

Create your folder for images WebEntry\000\
Put your images in it.... tta1.png, tta2,png etc

Run the bsv.
Create a SystemSettings Record

Click Create Web Section button at top Right...

jaymerweb.bsv.zip
(38.42 KiB) Downloaded 340 times
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
ACDC
Posts: 1138
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: Stupid Context issue. How do I fix this?

Post by ACDC »

DO I REALLY have to have a "master" process, and then 6 separate processes?
I would remove the IMPORT part of the process and insert it as an Object Rule
or
alternatively, use START PROCESS (store process name on the object and then call the process from the original process ) this will lock down the context
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Stupid Context issue. How do I fix this?

Post by Jaymer »

acdc, thanks
i'd like to try both ways

1) is this was you mean by the RULE method?
Screen Shot 2018-12-06 at 11.40.56 AM.png
Screen Shot 2018-12-06 at 11.40.56 AM.png (85.31 KiB) Viewed 7087 times
2) Could you give me a specific example of the 2nd syntax with START PROCESS?


NOTE:
Its ironic, that the RULE method works great.
When IN FACT, I really don't want to assign an Image at all.
But Aware is making me.
See https://awareim.com/forum/viewtopic.php?f=1&t=10767 thread.
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
ACDC
Posts: 1138
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: Stupid Context issue. How do I fix this?

Post by ACDC »

is this was you mean by the RULE method?
Yes
Could you give me a specific example of the 2nd syntax with START PROCESS?
START PROCESS WebPics.ProcessName (ProcessName being a Text Attribute containing the name of the process set by an object rule) I use this extensively to reduce the complexity of the original process and also guarantee correct context.
When IN FACT, I really don't want to assign an Image at all.
I don't understand this, when you create the path it should not rely on the image being present. Obviously, if the path relies on the image name (filename) and it's not present then I can see the problem, but the path should not be related -- I must be misunderstanding something, sorry

You said this in the other thread (trying to understand :? )
if the PATH is empty, it fails.
There cannot be a path yet, cause there is no image.
Why can't you name the path 'c:\WebEntry\<<WebPic.ID>>front.png' - This way the path is always present and when the image is uploaded it points to this path
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Stupid Context issue. How do I fix this?

Post by Jaymer »

Good Qs ACDC - the fact that I don't want an image AT ALL should be cleared up in that video on the other thread. I didn't want to clutter this Context HOWTO issue with the Image issues.
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
Post Reply